What is the significance of CommandBehavior.CloseConnection
| To avoid having to explicitly close the connection associated with the command used to create either a SqlDataReader or and OleDbDataReader, pass the CommandBehavior.CloseConnection argument to the ExecuteReader method of the Connection.
dr= cmd.ExecuteReader(CommandBehavior.CloseConnection); The associated connection will be closed automatically when the Close method of the Datareader is called. This makes it all the more important to always |
|
| remember to call Close on your datareaders. | |
