R
rockdale.green
I am using Microsoft.Practices.Enterprise.Library
When I use IDataReader I saw this line
"It is the responsibility of the caller to close the connection and
reader when finished."
I was wondering if I close the DataReader do I automatic ally close the
Connection? If not , how can I close the Connection outside the
ExecuteReader function?
I code snippet is like following:
------------------------------------------------
IDataReader oDr =null;
Database db = DatabaseFactory.CreateDatabase();
string sqlCommand = "my_stored_proc";
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
oDr = db.ExecuteReader(dbCommand);
/*DO SOMETHING WITH oDR*/
/*I close the DataReader here, do I need to close connection also?*/
oDr.Close();
When I use IDataReader I saw this line
"It is the responsibility of the caller to close the connection and
reader when finished."
I was wondering if I close the DataReader do I automatic ally close the
Connection? If not , how can I close the Connection outside the
ExecuteReader function?
I code snippet is like following:
------------------------------------------------
IDataReader oDr =null;
Database db = DatabaseFactory.CreateDatabase();
string sqlCommand = "my_stored_proc";
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
oDr = db.ExecuteReader(dbCommand);
/*DO SOMETHING WITH oDR*/
/*I close the DataReader here, do I need to close connection also?*/
oDr.Close();