P
Patrick Questembert
I am running MySQL 4.1 Gamma on WinXP under VS 2003 / ADO.NET and trying to
use the OleDb ExecuteScalar() method (as opposed to the DataReader) and
consistently failing - getting 0 always.
Here is the code:
catCMD.CommandText = "SELECT count(*) from MyTable;"
long N = (long)catCMD.ExecuteScalar();
N is always 0, even though there are rows in the table.
As a side issue, I find it rather painful to guess the type of data items
returned by the OleDb objects ... initially I had:
int N = (int)catCMD.ExecuteScalar();
This caused an exception - as if C# can't handle a conversion from int64 to
int32 ...
Thanks!
Patrick
use the OleDb ExecuteScalar() method (as opposed to the DataReader) and
consistently failing - getting 0 always.
Here is the code:
catCMD.CommandText = "SELECT count(*) from MyTable;"
long N = (long)catCMD.ExecuteScalar();
N is always 0, even though there are rows in the table.
As a side issue, I find it rather painful to guess the type of data items
returned by the OleDb objects ... initially I had:
int N = (int)catCMD.ExecuteScalar();
This caused an exception - as if C# can't handle a conversion from int64 to
int32 ...
Thanks!
Patrick