Subject: Unable to change DB values using ASP
Posted By: dghughes42 Post Date: 1/30/2004 4:05:33 PM

Can somebody please tell me why I'm unable to update
an access database using this code:
    Dim ConnectionString
    ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\wedding.mdb"
    Dim Connection
    Set Connection = Server.CreateObject("ADODB.Connection")
    Connection.Open ConnectionString, adOpenDynamic, adLockOptimistic, adCmdText
    
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.open "Select * FROM Guests WHERE ID=" & Request("GuestName"), Connection
    
    If Request.Form("GuestNumber") = 0 Then
        Response.write "<div class='heading'>Don't forget to submit your guest number!</div>"
    Else
        If Request.Form("GuestNumber") = 6 Then
            rs("GuestStatus") = 3
        Else    
            rs("GuestNumber") = Request.Form("GuestNumber")
            rs("GuestStatus") = 1
        End If
    End If
    
    rs.Close
    Set rs = Nothing
    
    Connection.Close
    Set Connection = Nothing
I'm getting a server error that the server is unable
to do procedure or some nonsense and the DB changes
are not occurring.  I'm able to see the DB and populate
selects and such, just no changin' DB values.
I haven't coded in a few years, did something change
that I should know about?
Reply By: KenSchaefer Reply Date: 1/31/2004 12:45:55 AM
I would suggest you post the *exact* error message you are receiving.

However, your code appears to be incorrect. Properties like "cursortype", and "locktype" are properties of the *recordset* not the *connection*. You need to open the recordset with an updateable locktype

Cheers
Ken

Microsoft MVP - Windows Server (IIS)
www.adOpenStatic.com
Reply By: dghughes42 Reply Date: 1/31/2004 1:04:34 PM

Here is my error message:

Technical Information (for support personnel)

Error Type:
ADODB.Recordset (0x800A0CB3)
Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.
/Wedding/reply.asp, line 18


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)

Page:
POST 25 bytes to /Wedding/reply.asp

POST Data:
guestname=4&guestnumber=2




line 18 corresponds with:
rs("GuestNumber") = Request.Form("GuestNumber")

Go to topic 9235

Return to index page 958
Return to index page 957
Return to index page 956
Return to index page 955
Return to index page 954
Return to index page 953
Return to index page 952
Return to index page 951
Return to index page 950
Return to index page 949