Current Recordset does not support updating.

B

barret bonden

(closest newsgroup I could find)
Error Type:
ADODB.Recordset (0x800A0CB3)
Current Recordset does not support updating. This may be a limitation of the
provider, or of the selected locktype.
/asp_data3_add.asp, line 30

<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsAddComments 'Holds the recordset for the new record to be added
Dim strSQL 'Holds the SQL query to query the database


'1Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'2Set an active connection to the Connection object using a DSN-less
connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("t.mdb")

'3Create an ADO recordset object
Set rsAddComments = Server.CreateObject("ADODB.Recordset")

'4Initialise the strSQL variable with an SQL statement to query the
database
strSQL = "SELECT last, first FROM main;"

'5 Set the cursor type we are using so we can navigate through the
recordset
rsAddComments.CursorType = 2

'Set the lock type so that the record is locked by ADO when it is updated
'rsAddComments.LockType = 3


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

'Tell the recordset we are adding a new record to it
rsAddComments.AddNew

'Add a new record to the recordset
rsAddComments.Fields("last") = Request.Form("last")
rsAddComments.Fields("first") = Request.Form("first")


'Write the updated recordset to the database
rsAddComments.Update

'Reset server objects
rsAddComments.Close
Set rsAddComments = Nothing
Set adoCon = Nothing

'Redirect to the guestbook.asp page
'Response.Redirect "asp_data2.asp"
%>
 
S

Sylvain Lafontaine

The good newsgroup for a question about databases and ASP would be
microsoft.public.inetserver.asp.db

Second, using the old ODBC driver is probably not the best idea; you should
use the OLEDB provider instead.

Third, you must make sure that in your Select statement, the primary key for
the table has been selected (and that your table has a primary key defined,
of course).

Fourth, using constant such as « CursorType = 2 » without writing a notice
about its definition is not the best thing to do. Personally, I don't
remember at all the definition of 2 and of 3 in this context.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top