V
Varangian
Hello there people,
I'm having some kind of problem. I have a function that returns a
datareader. At some point using the application I get an error
"Unspecified error" (ssssoooo helpful)
. I think I know the problem.
My Connection remains open.
Is there a way I can do to close the Connection. below is the code.
Thank you very much as always
public System.Data.OleDb.OleDbDataReader DataReaderFunc(string
SQLSelect)
{
OleDbDataReader objDataRead = null;
OleDbConnection objConn = new OleDbConnection();
objConn.Close();
objConn.ConnectionString = GetConnection();
OleDbCommand objComm = new OleDbCommand(SQLSelect, objConn);
objConn.Open();
objDataRead = objComm.ExecuteReader(CommandBehavior.CloseConnection);
Console.WriteLine (objConn.State);
//objConn.Dispose();
return objDataRead;
}
I'm having some kind of problem. I have a function that returns a
datareader. At some point using the application I get an error
"Unspecified error" (ssssoooo helpful)

My Connection remains open.
Is there a way I can do to close the Connection. below is the code.
Thank you very much as always
public System.Data.OleDb.OleDbDataReader DataReaderFunc(string
SQLSelect)
{
OleDbDataReader objDataRead = null;
OleDbConnection objConn = new OleDbConnection();
objConn.Close();
objConn.ConnectionString = GetConnection();
OleDbCommand objComm = new OleDbCommand(SQLSelect, objConn);
objConn.Open();
objDataRead = objComm.ExecuteReader(CommandBehavior.CloseConnection);
Console.WriteLine (objConn.State);
//objConn.Dispose();
return objDataRead;
}