Click to See Complete Forum and Search --> : Error while retrieving data with CRecordSet


Anand Sawant
May 25th, 1999, 03:49 AM
Dear all,

I am creating a MFC dialog based application in VC++ 6.0.
Database is MS-Access.
Driver is ODBC.
Platform: WIN NT.

Description of my table is as follows.

Table Name - Machine

Machine ID (Primary key)- Number
Machine Name - Text
Machine Type - Text
Clamping Tonnage - Number
Injection Force - Number

StdMachineSet is the object of class derived from CrecordSet.

StdMachineSet.Open(CRecordset::dynaset,
"SELECT DISTINCT [Machine Name] FROM Machine",
CRecordset::readOnly);

It gives me the error : Error retreiving record.

When I changed the query to

StdMachineSet.Open(CRecordset::dynaset,
"SELECT * FROM Machine"
CRecordset::readOnly);

It works fine.

What might be the problem?

Regards,

Anand.