Dheeman Dutta

Just Another Blog.....

  Home  |   Contact  |   Syndication    |   Login
  39 Posts | 1 Stories | 29 Comments | 12 Trackbacks

News



Archives

Post Categories

.NET Links

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 .

 

posted on Saturday, June 17, 2006 2:41 AM