Hi,
I have a problem which I hope is easy. I have a program written in C#. Im using a DataReader to retrive 4 rows of data from a Sybase database. Everything seems to work fine except when I call the DataReader.Close() method. The system just hangs. Im using the OleDbDataReader. When I trace through the code using the debugger, I see that correct data is being returned in a timely manner. Also if I use Odbc objects (OdbcConnection, OdbcDataReader, OdbcCommand) with the appropriate connect string, everything works fine. Any help or guidance would be appreciated. Thanks. Heres the code.
OleDbConnection myConn = new OleDbConnection(Session["ConnectionString"].ToString());
string mySelectQuery = "select id from Cashflow where number = 464000";
OleDbCommand myCommand = new OleDbCommand(mySelectQuery,myConn);
OleDbDataReader dr;
myConn.Open();
dr = myCommand.ExecuteReader();
while (dr.Read())
{
ListBox2.Items.Add(dr[0].ToString());
}
dr.Close(); // <---- System hangs here!
myConn.Close();
Thanks,
LeifW
I have a problem which I hope is easy. I have a program written in C#. Im using a DataReader to retrive 4 rows of data from a Sybase database. Everything seems to work fine except when I call the DataReader.Close() method. The system just hangs. Im using the OleDbDataReader. When I trace through the code using the debugger, I see that correct data is being returned in a timely manner. Also if I use Odbc objects (OdbcConnection, OdbcDataReader, OdbcCommand) with the appropriate connect string, everything works fine. Any help or guidance would be appreciated. Thanks. Heres the code.
OleDbConnection myConn = new OleDbConnection(Session["ConnectionString"].ToString());
string mySelectQuery = "select id from Cashflow where number = 464000";
OleDbCommand myCommand = new OleDbCommand(mySelectQuery,myConn);
OleDbDataReader dr;
myConn.Open();
dr = myCommand.ExecuteReader();
while (dr.Read())
{
ListBox2.Items.Add(dr[0].ToString());
}
dr.Close(); // <---- System hangs here!
myConn.Close();
Thanks,
LeifW