is this efficient way of writing the stored procedure in a loop??
for (int i = 0; i < purchaseListView.Items.Count; i++)
Connection con = new Connection();
SqlCommand cmd = new SqlCommand();
SqlCommand cmdFifo = new SqlCommand();
cmd.Connection = con.DataBaseConnection;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "insertDetail";
cmdFifo.Connection = con.DataBaseConnection;
cmdFifo.CommandType = CommandType.StoredProcedure;
cmdFifo.CommandText = "insertInToMain";
please let me know the right way of looping the stored procedure
Edited 15-Mar-13 6:38am
No, because you open the connection again and again and again. Outside your loop, open the connection.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)