Flash Games

 FAQ   Search   Members   Groups   User Control Panel      Login 

It is currently Fri Dec 05, 2008 2:08 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: [Microsoft][ODBC Microsoft Access Driver]Invalid bookmark
PostPosted: Tue Oct 24, 2006 4:10 pm 
Offline

Joined: Wed Sep 27, 2006 2:20 pm
Posts: 1
I am writing to two tables which need to keep referential integrity.

When the tables are empty the code functions correctly and writes out to the sales table. It then retrieves the Autonumber Primary key so that it can be used to write sales line items to the second table.

The second time the code is executed I get an Invalid bookmark error.

The code follows:

'Create a database connection
set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open ConnectionString

'
'Open Recordset for sales
'
set rsSale = Server.CreateObject("ADODB.Recordset")
set rsLine = Server.CreateObject("ADODB.Recordset")

strSQL = "SELECT tblSales.chrMobile, " & _
"tblSales.chrPaymentMethod, " & _
"tblSales.idsInvoiceNumber " & _
"FROM tblSales;"

rsSale.CursorType = adOpenKeyset
rsSale.LockType = adLockOptimistic
rsSale.Open strSQL, adoCon
rsSale.Addnew

'write mobile number (users account number) & paymentmethod
rsSale.Fields("chrMobile") = Session("Mobile")
rsSale.Fields("chrPaymentMethod") = strPaymentMethod
rsSale.Update
Freeze = rsSale.Bookmark ' First, store the location of you cursor
rsSale.Requery ' Next, update your recordset with the data from the database
rsSale.Bookmark = Freeze ' Restore cursor (This is where the error occurs)
strInvoiceNumber = rsSale("idsInvoiceNumber") 'Get the just written autonumber
rsSale.Close

strSQL = "SELECT tblSalesLineItems.chrProductID, " & _
"tblSalesLineItems.intQuantity, " & _
"tblSalesLineItems.lngzInvoiceNumber, " & _
"tblSalesLineItems.lngzLineNumber " & _
"FROM tblSalesLineItems;"

rsLine.CursorType = adOpenDynamic
rsLine.LockType = adLockOptimistic
rsLine.Open strSQL, adoCon


'write the line items
intItems = 0
For Each strProductID in dictCart
intItems = intItems + 1
rsLine.AddNew
rsLine.Fields("chrProductID") = strProductID
rsLine.Fields("intQuantity") = dictCart(strProductID)
rsLine.Fields("lngzInvoiceNumber") = strInvoiceNumber
rsLine.Fields("lngzLineNumber") = intItems
rsLine.Update
Next

'Close recordSet
set rsLine = Nothing
set rsSale = Nothing
set adocon = Nothing


Can Anyone see what;'s going wrong?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group - Flash Games

Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User:
Pass:
Log me on automatically each visit: