Tuesday, June 30, 2009

Daily Tips- Tip #3 - Automatically closing a connection after datareader finishes execution





To automatically close a connection after datareader finishes execution, you need to specify the CommandBehaviour.CloseConnection parameter to the command object, as


drEmployees = cmdEmployees.ExecuteReader(CommandBehaviour.CloseConnection);



No comments:

Post a Comment