Re: CRecordset::Open error

Tech-Archive recommends: Fix windows errors by optimizing your registry



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




.



Relevant Pages

  • Re: Update with subquery
    ... >But I get syntax error. ... Hi Manish, ... I copied this statement to Query Analyzer, ... immediately before or after the statement indicated in the error message. ...
    (microsoft.public.sqlserver.clients)
  • Re: Question about LinQ (LinQ to Sql)
    ... If you have a syntax error in the LINQ ... query you will get the error message when you compile the code. ... You can use LINQ To Objects to query any kind of collection in memory. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: PEAR MDB2 - Fatal error: Call to undefined function MDB2_Driver_mssql::getMessage()
    ... the error message for the $result object. ... An error occurred while trying to execute the following query: ... select UserKey from where UserName =? ... Error message: MDB2 Error: syntax error ...
    (comp.lang.php)
  • Re: Nested IIF Statement syntax(?) problem
    ... I got the same "Extra) in query" error message. ... doesn't have to be an IIF statement. ... On the second I get an "Syntax error in query expression" ...
    (microsoft.public.access.queries)
  • Re: OutputTo to Excel question
    ... I can't help you with the macro error message as I don't use macros. ... the result from a query. ... Save a query that pulls the same data as the report. ...
    (microsoft.public.access.macros)