Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_database_setup thread: ASP " Update" command Problem


Message #1 by "Neil Peters" <npeters21@m...> on Sun, 10 Nov 2002 11:04:12 -0600
Here is my code.
I am trying to update MS Access 2002

Dim rsUsers
  Set rsUsers = Server.CreateObject("ADODB.Recordset")
  rsUsers.Open "tblUser", objConn, adOpenDynamic, adLockOptimistic, 
adCmdTable

  If Session("PersonID") <> "" Then
    rsUsers.Filter = "PersonID = '" & Session("PersonID") & "'"
  Else
    rsUsers.Filter = "EMail = '" & Request.Form("email") & "'" & _
                     "AND Password = '" & Request.Form("password") & "'"
    If rsUsers.EOF Then
      rsUsers.AddNew
'   Else
'     Email address and password matched with DB records -
'     In this case we'll allow this to update user's personal details
    End If
  End If

  rsUsers("EMail") = Request.Form("email")
  rsUsers("Password") = Request.Form("password")
  rsUsers("LastName") = Request.Form("LastName")
  rsUsers("FirstName") = Request.Form("FirstName")
  rsUsers("City") = Request.Form("City")
  rsUsers("Province") = Request.Form("Province")
  rsUsers("Country") = Request.Form("Country")
  rsUsers.Update

  Dim strName, strValue
  For each strField in rsUsers.Fields
    strName = strField.Name
    strValue = strField.value
    Session(strName) = strValue
  Next
  Session("blnValidUser") = True
  Response.Redirect "MenuForRegisteredUsers.asp"


I get this:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object 
is read-only.

Why does it think the it is read only?

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

Message #2 by "Ken Schaefer" <ken@a...> on Tue, 12 Nov 2002 15:33:04 +1100
Do you have <% Option Explicit %> in your code? Otherwise, how do you know
that adOpenDynamic is actually defined?

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Neil Peters" <npeters21@m...>
Subject: [asp_database_setup] ASP " Update" command Problem


: Here is my code.
: I am trying to update MS Access 2002
:
: Dim rsUsers
:   Set rsUsers = Server.CreateObject("ADODB.Recordset")
:   rsUsers.Open "tblUser", objConn, adOpenDynamic, adLockOptimistic,
: adCmdTable
:
:   If Session("PersonID") <> "" Then
:     rsUsers.Filter = "PersonID = '" & Session("PersonID") & "'"
:   Else
:     rsUsers.Filter = "EMail = '" & Request.Form("email") & "'" & _
:                      "AND Password = '" & Request.Form("password") & "'"
:     If rsUsers.EOF Then
:       rsUsers.AddNew
: '   Else
: '     Email address and password matched with DB records -
: '     In this case we'll allow this to update user's personal details
:     End If
:   End If
:
:   rsUsers("EMail") = Request.Form("email")
:   rsUsers("Password") = Request.Form("password")
:   rsUsers("LastName") = Request.Form("LastName")
:   rsUsers("FirstName") = Request.Form("FirstName")
:   rsUsers("City") = Request.Form("City")
:   rsUsers("Province") = Request.Form("Province")
:   rsUsers("Country") = Request.Form("Country")
:   rsUsers.Update
:
:   Dim strName, strValue
:   For each strField in rsUsers.Fields
:     strName = strField.Name
:     strValue = strField.value
:     Session(strName) = strValue
:   Next
:   Session("blnValidUser") = True
:   Response.Redirect "MenuForRegisteredUsers.asp"
:
:
: I get this:
: Error Type:
: Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
: [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or
object
: is read-only.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  Return to Index