Trying to run a query while in a reader loop...

  • Thread starter Thread starter Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+
  • Start date Start date
A

Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+

I have a loop that is parsing the rows of a table, under certain
circumstances, I need to query another table with a value from the
table that the reader is parsing, but when I try to create another
sqlcommand to run the query against the other table, it say that there
is another object that has the sqlconnection open and must be closed
first. How do I get around this. I assumt the reader loop is what has
the sqlconnection open, which is fine, but how do I run another querry
from within the loop?
Thanks in advance!
 
Use a left join to bring in the data from both tables in a single
query. Even if only some of the records have data in both tables, it
will be far more performant to use a single query than run queries
inside a loop.

Sam


------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.



On Tue, 03 Jul 2007 12:42:29 -0700, "Andrew Meador - ASCPA, MCSE,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top