HasRows bug
Posted: Thu 12 Jul 2007 09:56
Hi,
We're experiencing problems when using the UniDataReader.HasRows property. It seems to always return true even though there is no data present. The same goes for UniDataReader.Read() which returns true even when no records have been returned.
We have tested this with both SQL Server and MYSQL providers.
Here is an example with a SQL query which deliberately returns no data:
Our CoreLab.UniDirect assembly version is 2.5.7.0.
We're experiencing problems when using the UniDataReader.HasRows property. It seems to always return true even though there is no data present. The same goes for UniDataReader.Read() which returns true even when no records have been returned.
We have tested this with both SQL Server and MYSQL providers.
Here is an example with a SQL query which deliberately returns no data:
Code: Select all
string query = "SELECT * FROM TBL_ORG WHERE ORG_CODE='FOOBAR'";
UniDataReader reader = command.ExecuteReader();
if (reader.HasRows) { // <-- returns true even without data
if (reader.Read()) { // <-- also returns true
reader.GetValue(0); // <-- now yields InvalidOperationException!
}
}