Results 1 to 2 of 2

Thread: Can't add a record from ASP page with ADO

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Sussex, England
    Posts
    45
    I'm getting the following error when trying to add a new record :

    Microsoft JET Database Engine error '80040e09'

    Cannot update. Database or object is read-only.

    /software/submitfaq.asp, line 9


    The code i'm using is :

    Set Con = Server.CreateObject ("ADODB.Connection")
    Con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\InetPub\wwwroot\development\News.mdb;Persist

    Security Info=False"

    Set rs = Server.CreateObject( "ADODB.Recordset" )
    rs.Open "Software_FAQs", Con, 3, 3
    rs.AddNew
    rs("CR") = TRIM(Request.Form("CR"))
    rs("FAQ_Question") = TRIM(Request.Form("Question"))
    rs("FAQ_Answer") = TRIM(Request.Form("Answer"))
    rs("Published_by") = TRIM(Request.Form("Published"))
    rs("Application") = TRIM(Request.Form("Application"))
    rs.Update
    rs.Close
    Con.Close


    I've used this code succesfully before on different projects so i can only think it's something to do with the configuration of IIS etc. I've made sure IUSER_Machinename has 'change' permission on the .mdb file but do I need to do anything else ?

    Thanks in advance
    Ian.

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    It's because you opened recordset with adOpenStatic mode which has a value of 3. In order for you to be able to update your recordset, you have to open it as adOpenKeyset (1) or adOpenDynamic (2). So the code to open recordset would be like this:
    Code:
    rs.Open "Software_FAQs", Con, 3, 1  'adOpenKeyset

Posting Permissions

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



Click Here to Expand Forum to Full Width