|
-
May 25th, 1999, 03:56 AM
#1
Error while retrieving data with CRecordSet
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: ynaset,
"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: ynaset,
"SELECT * FROM Machine",
CRecordset::readOnly);
It works fine.
What might be the problem?
Regards,
Anand.
-
May 25th, 1999, 06:29 PM
#2
Re: Error while retrieving data with CRecordSet
Just off the top of my head:
SELECT DISTINCT returns a static recordset. If you try
CRecordset::snapshot instead of CRecordset: ynaset
your query might succeed.
HTH,
Peter
-
May 25th, 1999, 11:14 PM
#3
Re: Error while retrieving data with CRecordSet
Hi Peter,
It didn't work with CRecordset::snapshot also.
Anand.
-
May 26th, 1999, 02:14 AM
#4
Re: Error while retrieving data with CRecordSet
OK,
How does your DoFieldExchange function look?
Regards,
Peter
-
May 26th, 1999, 04:34 AM
#5
Re: Error while retrieving data with CRecordSet
void CMachineSet: oFieldExchange(CFieldExchange* pFX)
{
//{{AFX_FIELD_MAP(CMachineSet)
pFX->SetFieldType(CFieldExchange: utputColumn);
RFX_Int(pFX, _T("[MachineID]"), m_MachineID);
RFX_Text(pFX, _T("[Machine Name]"), m_Machine_Name);
RFX_Text(pFX, _T("[Machine Type]"), m_Machine_Type);
RFX_Double(pFX, _T("[Clamping Tonnage]"), m_Clamping_Tonnage);
RFX_Double(pFX, _T("[Injection Force]"), m_Injection_Force);
//}}AFX_FIELD_MAP
}
Regards,
Anand.
-
May 26th, 1999, 08:01 AM
#6
Re: Error while retrieving data with CRecordSet
There's the problem: You have only the [Machine Name] field in your recordset. The Field exchange function expects all the fields of your table.
Regards,
Peter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|