Hello and thank you once again for your wonderful help; I really appreciate it
This the relevant part from placead.asp from the ASP For Dummies CD-ROM:
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "ClassDSN"
Set Classifieds = Server.CreateObject("ADODB.Recordset")
Classifieds.Open _
"SELECT * FROM Items WHERE Category='" & _
Request("Category") & "'",_
Connect,adOpenDynamic,adLockOptimistic
Classifieds.AddNew
Classifieds("Item") = Request("Item")
Classifieds("Category") = Request("Category")
Classifieds("Description") = Request("Description")
Classifieds("Price") = Request("Price")
Classifieds("Phone") = Request("Phone")
Classifieds("Email") = Request("Email")
Classifieds("State") = Request("State")
Classifieds("Posted") = Date
Classifieds("Password") = Request("Password")
Classifieds.Update
This uses a system DSN which is set up properly, and gives this:
Operation is not allowed when the object is closed.
I have also tried the following to do it without using a DSN:
' construct path...
path = Request.ServerVariables("Path_Translated")
path = Left(path,InStrRev(path,"\")) & "classdb.mdb"
' Open Connection
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & path
' Open recordset
Set Classifieds = Server.CreateObject("ADODB.Recordset")
Classifieds.Open ("SELECT * FROM Items WHERE Category='" & Request("Category") & "'"),_
Connect,adOpenDynamic,adLockOptimistic
Classifieds.AddNew
Classifieds ("Item") = Request("Item")
Classifieds ("Category") = Request("Category")
Classifieds ("Description") = Request("Description")
Classifieds ("Price") = Request("Price")
Classifieds ("Phone") = Request("Phone")
Classifieds ("Email") = Request("Email")
Classifieds ("State") = Request("State")
Classifieds ("Posted") = Date
Classifieds ("Password") = Request("Password")
Classifieds.Update
This gives the error message:
[Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only.
... so I think there must be something wrong in my amended code, am I opening the database object for read-only????
Thanks very much
Enter your message below
Sign in or Join us (it's free).