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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't Update Access Database with Variables

Status
Not open for further replies.

scripter73

Programmer
Apr 18, 2001
421
US
Hi,

I have some variables in my ASP script that I would like to insert as a record into my database table called ALOG. The table layout/datatypes are as follows:


Host_Addr (Text)
UserID (Text)
LogDate (Date/Time)
LogTime (Text)
RefURL (Text)
OpSysURL (Text)


The variables I want to insert are:

strHost(string)
strUser (string)
datDate (date)
strFinalTime (string)
strRefURL (string)
strOpSys (string)


I receiving this error when I attempt to update the database,

ADODB.Field error '800a0cb3'

The operation requested by the application is not supported by the provider.

/logs/split.asp, line 631


Here's my snippet of code (sorry it's so long):


'**************************
'OPEN DATABASE CONNECTION
'**************************
'create connection to database using dsn

dim adopenforwardonly, adlockreadonly, adcmdtable
adopenforwardonly = 0
adlockreadonly = 1
adcmdtable = 2

dim objconn, objrs
set objconn = server.createobject("ADODB.Connection")
set objrs = server.createobject("ADODB.Recordset")

dim strdatabasetype
strdatabasetype = "Access"

objconn.open "Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Data Source=d:\inetpub\ &_
"Persist Security Info=False"

objrs.open "Alog", objconn, adopenforwardonly, adlockreadonly, adcmdtable

'add new record using no argument

objrs("Host_Addr") = strHost 'line 631
objrs("UserID") = strUser
objrs("LogDate") = datDate
objrs("LogTime") = strFinalTime
objrs("RefURL") = strRefURL
objrs("OpSysURL") = strOpSys
objrs.Update



objrs.close
objconn.close
set objrs = nothing
set objconn = nothing




Thanks in advance!
scripter73
 
Here's some code that I wrote to update a database for a really bad message board (it worked, it just didn't have any advanced features like threading)

set objRS = Server.CreateObject("ADODB.Recordset")
objRS.CursorLocation = adUseServer
objRS.CursorType = adOpenKeyset
objRS.LockType = adLockOptimistic
objRS.Open "MessageTable2", objConn, , , adCmdTable

objRS.AddNew 'adds a new record
objRS("UserName")=strUserName
objRS("EmailAddress")=strEmailAddress
objRS("Subject")=strSubject
objRS("Message")=strMessage
objRS("PostDate")=dtPostDate

objRS.Update
intMessageNum = objRS("MessageNum")
 
specifically, the culprit is your locktype -- can't update a readonly recordset --

change it to adLockOptimistic or something else to clear the problem up
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top