Tuesday, April 12, 2011
SqlDataReader - There is already an open DataReader associated with this Command which must b...
Posted by Duc Nguyen at 7:14 AMSqlConnection firstConnection = new SqlConnection(connectionString);
firstConnection.Open();
SqlConnection secondConnection = new SqlConnection(connectionString);
secondConnection.Open();
try
{
using (SqlCommand firstCommand = new SqlCommand(firstQuery, firstConnection))
{
...
using (SqlDataReader firstReader = firstCommand.ExecuteReader())
{
while (firstReader.Read())
{
...
using (SqlCommand secondCommand = new SqlCommand(secondQuery, secondConnection))
{
...
using (SqlDataReader secondReader = secondCommand.ExecuteReader())
{
while (secondReader.Read())
{
...
}
}
}
}
}
}
}
catch (Exception ex)
{
...
}
firstConnection.Close();
secondConnection.Close();
Labels: C#
0 Comments:
Subscribe to:
Post Comments (Atom)