N
Nick
hi, all
I am just wondering if there is some difference between these two code:
I:
using(SqlDbConnection con = new .....)
{
SqlDbCommand cmd = new SqlDbCommand(strQuery, con);
cmd.ExecuteNonQuery();
}
Once the program exit the using }, the con should be disposed.
II:
SqlDbConnection con = null;
using(con = new .....)
{
SqlDbCommand cmd = new SqlDbCommand(strQuery, con);
cmd.ExecuteNonQuery();
}
Here, will it do the same thing as I? It might think there is still a
reference.
I am just wondering if there is some difference between these two code:
I:
using(SqlDbConnection con = new .....)
{
SqlDbCommand cmd = new SqlDbCommand(strQuery, con);
cmd.ExecuteNonQuery();
}
Once the program exit the using }, the con should be disposed.
II:
SqlDbConnection con = null;
using(con = new .....)
{
SqlDbCommand cmd = new SqlDbCommand(strQuery, con);
cmd.ExecuteNonQuery();
}
Here, will it do the same thing as I? It might think there is still a
reference.