Answer the question
In order to leave comments, you need to log in
C#. When to use using (in db)?
using (SqlConnection con = new SqlConnection())
{
SqlCommand cmd = con.CreateCommand();
cmd.CommandText = "SELECT * FROM Tab";
using (SqlDataReader reader = cmd.ExecuteReader())
{
// reading...
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question