My code snippet is this.
- Code: Select all
System.Data.OleDb.OleDbConnection con = new System.Data.OleDb.OleDbConnection("db-connection-string")
System.Data.OleDb.OleDbCommand stmt = con.CreateCommand();
stmt.CommandText = "SELECT COUNT(DISTINCT GroupID) AS count FROM MyTable";
System.Data.OleDb.OleDbDataReader rs = stmt.ExecuteReader();
I have also found the source of my problem

, it is the
- Code: Select all
AS count
part of the SQL. When this is removed I can use either ExecuteReader() or ExecuteScalar() okay.
It is worth noting that my SQL snippet is used okay for Oracle and Sqlserver with .NET, and also with Oracle, Sqlserver and Postgres with Java. Any thoughts as to why it will not work with your driver?