I have codes below...
Code: Select all
void doFetch()
{
MySqlConnection dbConn; // make the connection via direct mode.
MySqlCommand dbCmd = new MySqlCommand("select * from my_tbl", dbConn);
MySqlDataReader dbReader = dbCmd.ExecuteReader();
try {
int limit = 10;
while(dbReader.Read()) { // If the dbReader has 10000 records.
// do something...
if (limit++ > 1000) // break here!
break;
}
} finally {
if (dbReader != null)
dbReader.Close(); // VERY SLOW!!!!
}
}
When I tested those codes with CoreLab's Oracle Provider, the dbReader closed immediately.
But CoreLab.MySql.MySqlDataReader was not.
(I'm not sure but it seems to read all the records in Close() or Dispose().)
I tested it with the 'DataReader' in ~CoreLab/MySQLDirect.NET2/Samples
on Windows XP SP2, MySQL4.x and CoreLab.MySql3.30.10.0.
How can I solve this problem?
Thanks in ahead.