Error

tlmm

Guppy
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.
 
tlmm said:
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
%>
Thanks in advance.

add this above the open line

'Set the cursor type property of the record set to Dynamic so we can navigate through the record set
rsNominate.CursorType = 2

'Set the Lock Type for the records so that the record set is only locked when it is updated
rsNominate.LockType = 3

the open line is
'Open the recordset with the SQL query
rsNominate.Open "tblNomination", adoCon

that should fix it ..
 
i have just seen that you have the name of the table and not the strSQL below so use this open instead

'Open the recordset with the SQL query
rsNominate.Open strSQL, adoCon

that should fix it ..
 
It works with the first code that you gave me. If I try the open using strSQL instead of the table name in quotes, I get the following error:

ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/membership/EntNom.asp, line 43

Line 43: rsNominate.Open strSQL, adoCon

But this works:
rsNominate.Open "tblNomination", adoCon

Is there a reason why I can't use the strSQL variable here? I did try it, but since it wouldn't work, I changed it to the "tblNomination".

Thanks again.
 
Please disregard that last post. It does work. I had the following line commented out: strSQL = "SELECT * FROM tblNomination;"

Now it works both ways.

Thanks!
 
The page works fine until I put it up on the server where the web page is running from. When I hit the page and try to submit data entered, I get this error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x1288 Thread 0x838 DBC 0x148e3f4 Jet'.

/EntNom.asp, line 45

Line 45 is: adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("General.mdb")

Any ideas?

Thanks.
 
Got it working again. The db was supposed to be in the folder with the asp page but was not, so I moved it.
 
you can also use this faster driver to connect to your database if you are on win5 or win6
I think it will fail on Windows 2003 because of some buggy jet things

adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("General.mdb")
 
Back
Top