I usually use below code, should it be right ?
using (SqlConnection myConn = new SqlConnection(ConnectionString))
{
using (SqlCommand cmd = new SqlCommand(sqlString, myConn))
{
myConn.Open();
rows = cmd.ExecuteNonQuery();
}
// TO DO .
}
Which one is prefer? Please tell me the difference between them. In my opinion: when Pooling is false both close and dispose will shut down the connection. When Pooling is true close won't shut down the collection ,but dispose would.