K
Kay
Hi All,
I have loop that loop thru a data reader (i.e. conn = DB1Conn), in the loop,
I need to select some records from another database (i.e. conn - DB2Conn):
Do while theReader.Read
DB2Conn.Open
CmdSql = New SqlCommand("Select blar where Key = '" & theReader("Key")
& "'",DB2Conn)
Reader2 = Cmd.ExecuteReader
'Do something else...
DB2Conn.Close
DB2Conn.Open
CmdSql = New SqlCommand("Select blarblar where Key = '" &
theReader("Key") & "'",DB2Conn)
Reader2 = Cmd.ExecuteReader
'Do something else...
DB2Conn.Close
loop
Found that before I can do the 2nd select in the loop, I must close the
connection even the second select statment connect to the same database. Is
there any smarter, more efficient way to do the task?
Thanks.
Kay
I have loop that loop thru a data reader (i.e. conn = DB1Conn), in the loop,
I need to select some records from another database (i.e. conn - DB2Conn):
Do while theReader.Read
DB2Conn.Open
CmdSql = New SqlCommand("Select blar where Key = '" & theReader("Key")
& "'",DB2Conn)
Reader2 = Cmd.ExecuteReader
'Do something else...
DB2Conn.Close
DB2Conn.Open
CmdSql = New SqlCommand("Select blarblar where Key = '" &
theReader("Key") & "'",DB2Conn)
Reader2 = Cmd.ExecuteReader
'Do something else...
DB2Conn.Close
loop
Found that before I can do the 2nd select in the loop, I must close the
connection even the second select statment connect to the same database. Is
there any smarter, more efficient way to do the task?
Thanks.
Kay