p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Databases (http://p2p.wrox.com/forumdisplay.php?f=62)
-   -   Unable to change DB values using ASP (http://p2p.wrox.com/showthread.php?t=8808)

dghughes42 January 30th, 2004 05:05 PM

Unable to change DB values using ASP
 

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?

KenSchaefer January 31st, 2004 01:45 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

dghughes42 January 31st, 2004 02:04 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")


All times are GMT -4. The time now is 04:09 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.