private void a()
{
string query = "";
using (SqlConnection conn = new SqlConnection("connectionstring here"))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(query, conn))
{
cmd.ExecuteQuery();
}
conn.Close();
}
}
private void B()
{
string query = "";
SqlConnection conn = new SqlConnection("connectionstring here");
conn.Open();
SqlCommand cmd = new SqlCommand(query, conn);
cmd.ExecuteQuery();
conn.Close();
}
Which of the two is better to use? and why?