Cannot update. Database or object is read-only. Li

Results 1 to 3 of 3

Thread: Cannot update. Database or object is read-only. Li

  1. #1
    Join Date
    Dec 1969

    Default Cannot update. Database or object is read-only. Li

    &#060;%<BR>&#039;Dimension variables<BR>Dim adoCon &#039;Holds the Database Connection Object<BR>Dim rsAddComments &#039;Holds the recordset for the new record to be added to the database<BR>Dim strSQL &#039;Holds the SQL query for the database<BR><BR>&#039;Create an ADO connection odject<BR>Set adoCon = Server.CreateObject("ADODB.Connection")<BR><BR>&#0 39;Set an active connection to the Connection object using a DSN-less connection<BR>adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database.mdb")<BR><BR>&#039;Set an active connection to the Connection object using DSN connection<BR>&#039;adoCon.Open "DSN=guestbook"<BR><BR>&#039;Create an ADO recordset object<BR>Set rsAddComments = Server.CreateObject("ADODB.Recordset")<BR><BR>&#03 9;Initialise the strSQL variable with an SQL statement to query the database<BR>strSQL = "SELECT tblMembres.surnom, FROM tblMembres;"<BR><BR>&#039;Set the cursor type we are using so we can navigate through the recordset<BR>rsAddComments.CursorType = 2<BR><BR>&#039;Set the lock type so that the record is locked by ADO when it is updated<BR>rsAddComments.LockType = 3<BR><BR>&#039;Open the tblComments table using the SQL query held in the strSQL varaiable<BR>rsAddComments.Open strSQL, adoCon<BR><BR>&#039;Tell the recordset we are adding a new record to it<BR>rsAddComments.AddNew<BR><BR>&#039;Add a new record to the recordset<BR>rsAddComments.Fields("surnom") = Request.Form("surnomform")<BR>rsAddComments.Fields ("email") = Request.Form("emailform")<BR><BR>&#039;Write the updated recordset to the database<BR>rsAddComments.Update<BR><BR>&#039;Rese t server objects<BR>rsAddComments.Close<BR>Set rsAddComments = Nothing<BR>Set adoCon = Nothing<BR><BR>&#039;Redirect to the guestbook.asp page<BR>Response.Redirect "guestbook.asp"<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: Cannot update. Database or object is read-only

    You need to make sure the directory and access database itself has Read, Write, and Change (R,W,X) permissions. Contact your ISP. That&#039;s the place where I would start.

  3. #3
    Join Date
    Dec 1969

    Default Crosspost, already answered,

    repost, and *not* ASP.NET. Foru offenses for the price of one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts