Click to See Complete Forum and Search --> : query access help needed


pelegk1
03-29-2004, 07:38 AM
i am doing this :
SQL = "SELECT MAX(id) as lastNum FROM DonationDb "

RS.Open SQL,Conn,1,2
if request("DonationID")="" then
id=0
Else
id=int(rs("lastNum"))+1
end if
Response.Write "donationID=" & id & "&"
SQL = "INSERT INTO DonationDb SET ID='" & id & "'"

RS.Open SQL,Conn,1,2 (***)
when i try to dothe second rs.opne(***)
i get the message :
Operation is not allowed when the object is open.
why is that?>what to do?thanks in advance
peleg

buntine
03-29-2004, 07:55 AM
Peleg, have a look at what your doing here...

You have used the same ADO recordSet object twice. Hence, the error message informing you that the object is already in use, or 'open'.

You need to define/set another RecordSet object or close the first one before you try to open it again.

Regards,
Andrew Buntine.

drewex
03-31-2004, 04:33 PM
Use db.execute instead of open every time. Open one connection work on that

pelegk1
04-04-2004, 03:01 AM
alot drewex it solved my problem!
but i have another Question :
after that select i try to do another select on another table of the DB
and i get the message
"Operation is not allowed when the object is open.
"
what o do?
cant i make 2 selections?
thanks in advance
peleg

buntine
04-04-2004, 03:15 AM
Look, i already gave you the answer...

Make another recordSet object.. You cannot open the same object twice.

pelegk1
04-04-2004, 06:18 AM
doing another recordSet :(

buntine
04-04-2004, 06:27 AM
Post your code..