Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2004

    Lightbulb Unanswered: Adding records in database

    Good day to all :-)

    I am creating my first ASP database application the connection to the database is successfull but when i try to add new records the following errors occured:

    "Microsoft JET Database Engine (0x80040E09)
    Cannot update. Database or object is read-only."

    This is the code:

    dim strSQL
    dim adocn
    dim adors
    set adocn = server.createobject("adodb.connection")
    set adors = server.createobject("adodb.recordset")

    adocn.connectionstring = "provider=microsoft.jet.oledb.4.0; Data source=" & Server.MapPath("guestbook.mdb")

    strSQL = "SELECT tbguest.gid, tbguest.gcomments FROM tbguest;"

    adors.CursorType = adLockOptimistic
    adors.LockType = 3

    adors.Open strSQL,adocn

    adors.Fields("gid") = "1"
    adors.Fields("gcomments") = "ton"

    Set adors = Nothing
    Set adocn = Nothing


    By the way im using IIS web server and MS access database.
    Please anybody can help. thank you in advance.

  2. #2
    Join Date
    Jul 2004
    In your code:

    adors.CursorType = adLockOptimistic
    adors.LockType = 3

    You have set the cursor type to a lock constant. Your code really reads:

    adors.CursorType = adOpenStatic ' adOpenStatic=3
    adors.LockType = adLockOptimistic ' adLockOptimistic=3

    You could try setting the cursor type to 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