Re: CRecordset::Open error
- From: "Mubashir Khan" <mubi@xxxxxxxxx>
- Date: Thu, 4 Jan 2007 11:07:18 -0600
this is only my suggestion .... get way from the pain of MFC data access
classes ....... rather use ado
"Neil B" <NeilB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FBF0A36C-3EDE-4282-85C0-198B584C22B4@xxxxxxxxxxxxxxxx
Paul,
Thanks for your feedback.
I went back and rechecked what was in the DoFieldExchange against the
field
names in the table. Could not find any discrepencies. So I created my own
SELECT instead of letting it default to every field so I could isolate the
culprit. The code I used follows:
pCurrentDataSetODBC= new CReporterSet(g_pUserDb);
pCurrentDataSetODBC->m_strFilter="SELECT [Account]";
pCurrentDataSetODBC->Open(CRecordset::dynaset, "[Account Data]");
This resulted in the folling error message:
DBMS: ACCESS
Version: 04.00.0000
ODBC Driver Manager Version: 03.52.0000
Syntax error. in query expression 'SELECT `Account`'.
State:37000,Native:-3100,Origin:[Microsoft][ODBC Microsoft Access Driver]
I also tried it with a different field just in case the 'Account' field
was
the culprit.
This gave the same syntax error.
It doesn't get much simpler than this, so what would generate a syntax
error?
Is there something more fundamental about the table that might be creating
these problems?
Any ideas?
Thanks, Neil
"Paul S. Ganney" wrote:
The "Too few parameters. Expected 1." error means that there is one
term (normally a field name) in your query that's not in your table.
When you do CReporterSet->Open(), it will create a SELECT query using
all the field names in DoFieldExchange or DoBulkFieldExchange. If
you've changed a field name in the database but not in here, that would
cause this error message.
HTH
Paul.
Neil B wrote:
I'm trying to open a NEW table in my database and am getting the
following
error message:
"Too few parameters. Expected 1."
The code I used to do the open follows:
pCurrentDataSetODBC= new CReporterSet(g_pUserDb);
pCurrentDataSetODBC->Open(CRecordset::dynaset, "[Account Data]");
CReporterSet is derived from CRecordSet.
I've use this same code on all of the other tables in the database and
they
work fine.
I've traced the execution of the open thru to the execption throw, but
can
not get a handle on what parameter is being refered to in the error
message.
Any ideas how to get a handle on this????
Thanks, Neil
.
- References:
- Re: CRecordset::Open error
- From: Paul S. Ganney
- Re: CRecordset::Open error
- From: Neil B
- Re: CRecordset::Open error
- Prev by Date: Re: error C2440: 'type cast' : cannot convert from 'overloaded-function' to 'LPHANDLER_FUNCTION'
- Next by Date: Re: Save window image
- Previous by thread: Re: CRecordset::Open error
- Next by thread: Re: CRecordset::Open error
- Index(es):
Relevant Pages
|