General information
Category:
Database DAO/RDO/ODBC/ADO
Title:
Cannot update the recordset
Consider the following code:
SET cn = Server.CreateObject("ADODB.Connection")
cn.Open "JES"
IF Request.Form("cboDivisions") > "" AND _
Request.Form("txtInitials") > "" AND _
Request.Form("txtDateTaken") > "" AND _
Request.Form("txtKeyEntryDate") > "" AND _
Request.Form("cboMonthProcessed") > "" THEN
rs.CursorType = adOpenKeySet
rs.LockType = adLockPessimistic
SET rs = cn.Execute( _
"SELECT * FROM Journal_Types WHERE name= '" &_
Session("JournalType") & "'" )
IF rs.EOF THEN
EXIT SUB
END IF
counter = rs("count")
counter = counter + 1
rs("count") = counter
rs.Update
rs.Close
*** NOTE: The count field is not getting updated here
rs.LockType = adLockOptimistic
SET rs = cn.Execute( _
"SELECT * FROM Journal_Types WHERE name= '" &_
Session("JournalType") & "'" )
Session("JournalCode") = rs("code")
nEntry = rs("count")
cEntry = Session("JournalCode") & Request.Form("cboDivisions") & rs("count")
Session("JournalCode") = rs.code
cn.Execute "INSERT INTO Entries " &_
"(EntryNumber, Division, Initials, DateTaken, KeyEntryDate, MonthProcess) " &_
"VALUES (cEntry, " &_
"'" & Request.Form("cboDivisions") & "', " &_
"'" & Request.Form("txtInitials") & "', " &_
"'" & Request.Form("txtDateTaken") & "', " &_
"'" & Request.Form("txtKeyEntryDate") & "', " &_
"'" & Request.Form("cboMonthProcessed") & "' ) "
*** NOTE: Record is not getting added here.......
Q: Is there something I am missing????
Thanks in advance for any help.
Michael
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only