G
Guest
I have some methods that open a database connection, get some data and then
return a datareader. How do I manage closing the connection to the database
then?
public OracleDataReader ExecuteCommand(string cmdStr) {
Connect();
OracleCommand cmd = new OracleCommand(cmdStr, this._conn);
OracleDataReader reader = cmd.ExecuteReader();
return reader;
}
What's the correct way to do this, even if it means totally changing this
method?
return a datareader. How do I manage closing the connection to the database
then?
public OracleDataReader ExecuteCommand(string cmdStr) {
Connect();
OracleCommand cmd = new OracleCommand(cmdStr, this._conn);
OracleDataReader reader = cmd.ExecuteReader();
return reader;
}
What's the correct way to do this, even if it means totally changing this
method?