P
Paul K
I'm know the "old" implementation of ADO very well, and I
am now trying to get used to ADO.NET. I've always
preferred creating connection, commands and recordsets
programmaticaly since every application I've built that
needs data access allows for modifiable connection
settings. This leads me to my question:
When I create a OleDbConnection, OleDbCommand and
OleDbDataReader to retrieve data from an Access database,
everything works the way it should until I set the
CommandText for the OleDbCommand object. It seems that
if I try to order the results using the ORDER BY command
an OleDbException is thrown with the following
description:
Unspecified error: E_FAIL(0x80004005)
However, if I do not use and ORDER BY command, the
exception is not thrown. Here's the code:
public OleDbDataReader GetPopUps()
{
OleDbCommand cmd=new OleDbCommand();
OleDbDataReader dr;
cmd.Connection=mcn;
cmd.CommandType=CommandType.Text;
cmd.CommandText="SELECT PUKey, Domain FROM PopUp
ORDER BY Domain ASC";
dr = cmd.ExecuteReader();
cmd=null;
return dr;
}
Any help would be greatly appreciated.
Paul
am now trying to get used to ADO.NET. I've always
preferred creating connection, commands and recordsets
programmaticaly since every application I've built that
needs data access allows for modifiable connection
settings. This leads me to my question:
When I create a OleDbConnection, OleDbCommand and
OleDbDataReader to retrieve data from an Access database,
everything works the way it should until I set the
CommandText for the OleDbCommand object. It seems that
if I try to order the results using the ORDER BY command
an OleDbException is thrown with the following
description:
Unspecified error: E_FAIL(0x80004005)
However, if I do not use and ORDER BY command, the
exception is not thrown. Here's the code:
public OleDbDataReader GetPopUps()
{
OleDbCommand cmd=new OleDbCommand();
OleDbDataReader dr;
cmd.Connection=mcn;
cmd.CommandType=CommandType.Text;
cmd.CommandText="SELECT PUKey, Domain FROM PopUp
ORDER BY Domain ASC";
dr = cmd.ExecuteReader();
cmd=null;
return dr;
}
Any help would be greatly appreciated.
Paul