G
Greg Herrell
I think I must be going crazy?!
I am using a DataReader (OleDb in this case) to select some records from a
table. When I let the code execute it runs fine (via an ASP.Net page).
When I step through it using the debugger - the DataReader acts very
strange... My table has 5 records and while debugging it will iterate 2 out
of the 5 records before the call to Read() returns false.
This has been driving me nuts for a few hours now - hoping I am just really
beat and doing something obvious. Any insights, etc would be greatly
appreciated.
Below is a simplified block of code that reproduces the issue on my machine.
OleDbConnection oConn = new OleDbConnection(
System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"] )
;
oConn.Open();
OleDbCommand oCmd = new OleDbCommand("SELECT * FROM tblClients Order By
ClientID", oConn);
OleDbDataReader oReader = oCmd.ExecuteReader();
string a = "";
//--this block executes correctly unless I decide to step through it
//--the results read "1,2,3,45," when I just let it go
//--when I step through it I get "2,5,"
while( oReader.Read() )
{
a = oReader.GetValue(0).ToString();
Response.Write( a + "," );
}
oReader.Close();
oConn.Close();
Thanks,
G. Herrell
I am using a DataReader (OleDb in this case) to select some records from a
table. When I let the code execute it runs fine (via an ASP.Net page).
When I step through it using the debugger - the DataReader acts very
strange... My table has 5 records and while debugging it will iterate 2 out
of the 5 records before the call to Read() returns false.
This has been driving me nuts for a few hours now - hoping I am just really
beat and doing something obvious. Any insights, etc would be greatly
appreciated.
Below is a simplified block of code that reproduces the issue on my machine.
OleDbConnection oConn = new OleDbConnection(
System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"] )
;
oConn.Open();
OleDbCommand oCmd = new OleDbCommand("SELECT * FROM tblClients Order By
ClientID", oConn);
OleDbDataReader oReader = oCmd.ExecuteReader();
string a = "";
//--this block executes correctly unless I decide to step through it
//--the results read "1,2,3,45," when I just let it go
//--when I step through it I get "2,5,"
while( oReader.Read() )
{
a = oReader.GetValue(0).ToString();
Response.Write( a + "," );
}
oReader.Close();
oConn.Close();
Thanks,
G. Herrell