Just came accross this following snippet.
using(SqlConnection conn = new SqlConnection)
{
conn.Open();
SqlCommand cmd= new SqlCommand();
cmd.ExecuteNonQuery();
conn.Close()
}
It's always better off cosing this inside a using block , bcoz what is the command thows an exception. Inside the using block the object wil always be disposed .
Print | posted on Saturday, June 17, 2006 2:41 AM