Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot update. Database or object is read-only.

Status
Not open for further replies.

fortage

MIS
Jun 15, 2000
329
US
Microsoft JET Database Engine error '80040e09'

Cannot update. Database or object is read-only.

/addnew.asp, line 9
No sure why I'm receiving this error. I can write the fields to a page but not update.
Here is my code, line 9 is objrs.addnew
*********************8
Dim objrs, x, strcriteria, strconnect
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\websites\liquiflo\liquiflo.mdb;"
Set objrs = Server.CreateObject ("ADODB.Recordset")
objrs.open "Info", strConnect, 2, 2
objrs.MoveLast
objrs.AddNew
Objrs("Name")=request("Name")
*************************
 
Does your database have any locks on it? -- the way you have opened the recordset looks ok.
penny.gif
penny.gif
 
you cannot update because the defaul type for an ADODB.Recordset is read-only. if you want to make modification you have to put some suplimentary lines like this:

*********************8
Dim objrs, x, strcriteria, strconnect
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\websites\liquiflo\liquiflo.mdb;"
Set objrs = Server.CreateObject ("ADODB.Recordset")
objrs.CursorType=1 'adOpenKeyset
objrs.LockType=3'adLockOptimistic

objrs.open "Info", strConnect, 2, 2
objrs.MoveLast
objrs.AddNew
Objrs("Name")=request("Name")
*************************

this will surely help,:cool: Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
objrs.CursorType=1 'adOpenKeyset
objrs.LockType=3'adLockOptimistic
objrs.open "Info", strConnect, 2, 2

This is contradictory --

in the statement,
objrs.open "Info", strConnect, 2, 2

fortage is already declaring lockType and cursorType.

Fortage, have you solved the problem??
penny.gif
penny.gif
 
Thank you. With your observation you showed me annother posible problems in fortage's code.
Anyway here it is the code that you need:

*********************
Dim objconn, objrs, x, strcriteria, strconnect
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\websites\liquiflo\liquiflo.mdb;"

Set objConn = Server.CreateObject ("ADODB.Connection")
objConn.Open strConnect

Set objrs = Server.CreateObject ("ADODB.Recordset")
objrs.CursorType=1 'adOpenKeyset
objrs.LockType=3'adLockOptimistic
objrs.ActiveConnection = objConn
objrs.open "Info"

objrs.MoveLast
objrs.AddNew
Objrs("Name")=request("Name") Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top