I have an ASP page created that is trying to submit entered data to an Access db. When I click the Submit button, I receive the following error:
ADODB.Recordset error '800a0cb3'
Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.
/membership/EntNom.asp, line 41
Line 41 reads: rsNominate.AddNew
Trying to add to the open recordset.
Does anyone have any ideas as to why this may be occuring?
This is my code:
<%@ Language=VBScript %>
<%
Option Explicit
'Dim Variables
Dim adoCon 'Holds the db connection object
Dim rsNominate 'Holds the recordset for the records in the db
Dim strSQL 'Holds the SQL query to query the db
Dim strMode
Dim strNomFirstName, strNomLastName
strNomFirstName = Request.Form("txtFirstName")
strNomLastName = Request.Form("txtLastName")
'set hidden mode in a variable
strMode = Request.Form("txtHiddenMode")
if strMode = "SAVE" then
'CODE FOR DATABASE CONNECTION
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("MIS.mdb")
'Create ADO recordset object
Set rsNominate = Server.CreateObject("ADODB.Recordset")
'Initialize the strSQL variable with an SQL statement to query the db with
'Just selecting one record for testing purposes
'strSQL = "SELECT * FROM tblNomination;"
'Open the recordset with the SQL query
rsNominate.Open "tblNomination", adoCon
rsNominate.AddNew
rsNominate("nomFName") = strNomFirstName
rsNominate("nomLName") = strNomLastName
rsNominate.Update
rsNominate.Close
adoCon.Close
Set adoCon = Nothing
end if
%>
<HTML>
<HEAD>
</HEAD>
<!--Body Area Begins-->
<BODY bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<FORM Action="EntNom.asp" Method="Post" Name="frmNomination">
<CENTER>
<TABLE border="0" cellpadding="0" cellspacing="0" width="700">
<tr>
<td bgcolor="#FFFFFF" height="" width="700" border="0">
<font face="Tahoma" size="2">
<table bgcolor="#FFFFFF" height="" width="700" border="0">
<tr>
<td valign="left"><H><font size="2" color="#000000"><b>Nominee</b></font></H></td>
</tr>
<tr>
<td>
<table>
<!--First Name-->
<tr>
<td align="right" width="220"><font size="2" color="#000000">First Name:</font></td>
<td width="480" align="left"> <INPUT type="text" name=txtFirstName maxlength=50 size=30> </td> </tr>
<!--Last Name--> <tr>
<td align="right" width="220"><font size="2" color="#000000">Last Name:</font></td> <td width="480" align="left"> <INPUT type="text" name=txtLastName maxlength=50 size=30>
</td>
</tr>
<tr>
<td><INPUT type="hidden" name=txtHiddenMode Value=""></td>
</tr>
<tr>
<td><INPUT type="button" value="Submit" name=btnSubmit onclick='return onSubmitClick()'></td>
</tr>
</table>
</td>
</tr>
</table>
</font>
</td>
</tr>
</TABLE>
</CENTER>
</FORM>
</BODY>
</HTML>
<SCRIPT LANGUAGE="javascript">
<!--
//Submit the form
function onSubmitClick() {
window.document.frmNomination.txtHiddenMode.value = "SAVE";
window.document.frmNomination.submit();
return false;
}
document.frmNomination.txtFirstName.focus();
-->
</SCRIPT>
Thanks in advance.
ADODB.Recordset error '800a0cb3'
Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.
/membership/EntNom.asp, line 41
Line 41 reads: rsNominate.AddNew
Trying to add to the open recordset.
Does anyone have any ideas as to why this may be occuring?
This is my code:
<%@ Language=VBScript %>
<%
Option Explicit
'Dim Variables
Dim adoCon 'Holds the db connection object
Dim rsNominate 'Holds the recordset for the records in the db
Dim strSQL 'Holds the SQL query to query the db
Dim strMode
Dim strNomFirstName, strNomLastName
strNomFirstName = Request.Form("txtFirstName")
strNomLastName = Request.Form("txtLastName")
'set hidden mode in a variable
strMode = Request.Form("txtHiddenMode")
if strMode = "SAVE" then
'CODE FOR DATABASE CONNECTION
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("MIS.mdb")
'Create ADO recordset object
Set rsNominate = Server.CreateObject("ADODB.Recordset")
'Initialize the strSQL variable with an SQL statement to query the db with
'Just selecting one record for testing purposes
'strSQL = "SELECT * FROM tblNomination;"
'Open the recordset with the SQL query
rsNominate.Open "tblNomination", adoCon
rsNominate.AddNew
rsNominate("nomFName") = strNomFirstName
rsNominate("nomLName") = strNomLastName
rsNominate.Update
rsNominate.Close
adoCon.Close
Set adoCon = Nothing
end if
%>
<HTML>
<HEAD>
</HEAD>
<!--Body Area Begins-->
<BODY bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<FORM Action="EntNom.asp" Method="Post" Name="frmNomination">
<CENTER>
<TABLE border="0" cellpadding="0" cellspacing="0" width="700">
<tr>
<td bgcolor="#FFFFFF" height="" width="700" border="0">
<font face="Tahoma" size="2">
<table bgcolor="#FFFFFF" height="" width="700" border="0">
<tr>
<td valign="left"><H><font size="2" color="#000000"><b>Nominee</b></font></H></td>
</tr>
<tr>
<td>
<table>
<!--First Name-->
<tr>
<td align="right" width="220"><font size="2" color="#000000">First Name:</font></td>
<td width="480" align="left"> <INPUT type="text" name=txtFirstName maxlength=50 size=30> </td> </tr>
<!--Last Name--> <tr>
<td align="right" width="220"><font size="2" color="#000000">Last Name:</font></td> <td width="480" align="left"> <INPUT type="text" name=txtLastName maxlength=50 size=30>
</td>
</tr>
<tr>
<td><INPUT type="hidden" name=txtHiddenMode Value=""></td>
</tr>
<tr>
<td><INPUT type="button" value="Submit" name=btnSubmit onclick='return onSubmitClick()'></td>
</tr>
</table>
</td>
</tr>
</table>
</font>
</td>
</tr>
</TABLE>
</CENTER>
</FORM>
</BODY>
</HTML>
<SCRIPT LANGUAGE="javascript">
<!--
//Submit the form
function onSubmitClick() {
window.document.frmNomination.txtHiddenMode.value = "SAVE";
window.document.frmNomination.submit();
return false;
}
document.frmNomination.txtFirstName.focus();
-->
</SCRIPT>
Thanks in advance.