Well I am querying my DB, a table called bookBilling, to get a value under the column of billingID.
In my first query I get the customer ID from a table based on what value the cookie holds. In my second query I take that custID value and am looking to get the billingID associated with it.
query = 'SELECT custID FROM bookSession WHERE session=''&theCookie&''' '--Connect to DB' Set objConn = ConnectDB() '--Query to DB' Set objRS = objConn.Execute(query) custID = objRS.Fields('custID') query = 'SELECT billingID FROM bookBilling WHERE custID='&custID&'' objConn.Execute(query)
Here is where it becomes an issue. I tried using this to obtain the value:
billingID = objRS.Fields('billingID')
When that didn’t work I printed the query to my browser to make sure it worked and it came back good, I checked it in SQL Server Management Studio to make sure. After that I decided to play with it a bit and found that using ‘0’ as the reference works since it is the first item in my table.
billingID = objRS.Fields(0)
So that worked, I know my table column header is correct I have looked at it and used it in other queries before. Does anyone know why this might happen? Is it a result of not clearing my connection or closing it afterward?
Thanks
Hey, is it a typo that you don’t have this?
To reload the recordset with the data and definition of the second query…..
Just a thought, try Setting/Instantiating the ObjRS to a Recordset first, then apply the query.execute to it after, rather than the initial all in one with the first CustId query