Seek advice on 2 SqlConnections algorithm

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hi,

I wrote a win application which use DataReader and while
(reader.Read()) to read a table's data and then assign
them to local variables for other methods to use.

It is the first sqlconnection.

Insides the while loop, I need to call a StoredProcedure
to insert the data to another table. So, I made the 2nd
sqlconnection insides the while loop of the 1st
sqlconnection.

They work fine. But, I think there should be better
algorithm, e.g. just to use one SqlConnection.

Anyone could give me some advice?

Thanks
 
You might want to consider just putting your data into a dataset, and then
looping through that to call the stored procedure.
 
But, I need to pass each row of data to another method one
by one.

DataSet will fill all data from the sqlDataAdapter.
 
Back
Top