Samir Bhogayta
What is the significance of CommandBehavior.CloseConnection ?
By Samir Bhogayta in C# on Sep 03 2015
  • Sunil Babu
    Apr, 2016 2

    closes the Sql Connection on data loaded. No need to write SlqConnection.Close()

    • 0
  • Samir Bhogayta
    Sep, 2015 3

    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.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS