How to handle Multiple sqldatareader, pls help urgent !

georgewong

Member
Joined
May 11, 2006
Messages
5
Programming Experience
Beginner
Dear all :
Pls help with the following scenario:

'Grab the information from table 1
mycommand = New SqlCommand("select * table1 where userid = '1'", myconnection)
dr_table1 = mycommand.ExecuteReader(CommandBehavior.CloseConnection)
dr_table1.close
..
..
'Grab the information from table 2
myconnection.open
mycommand = New SqlCommand("select * table2 where item_code = '2'", myconnection)
dr_table2 = mycommand.ExecuteReader(CommandBehavior.CloseConnection)
'**** How can I have the information from dr_table1 at here since it was closed before !!
'**** I need to reference some fields from dr_table1 for calculation
..
..
dr_table2.close
Please advise, your kindly assistance is highly appreciately..
George
 
When you use a datareader on a connection, it creates an exclusive lock on that connection... meaning you CANNOT use thread for anything else. But... you *should* be able to open a second connection and use that on the second reader.

-tg
 
Back
Top