Tuesday, April 12, 2011

SqlConnection 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();

0 Comments:

Post a Comment