CDaoRecordset : Strange SQL-Query Error

CDaoRecordset : Strange SQL-Query Error

Post by Wolfgang Webe » Wed, 06 May 1998 04:00:00



Environment Windows 95/NT VC++5

I'm faced with a strange problem when using the CDaoRecordset Open() or
FindFirst() function with a SQL-query:
Although the SQL-query is simple and absolutly correct, a CDaoException
('Syntax error in number in query expression!')is thrown when calling the
function for the first time.
After that, if I repeat the execution with exactly the same query,
everthing works fine and I get my desired recordset.

Is there anyone who has a clue ?
Cheers, Wolfgang

 
 
 

CDaoRecordset : Strange SQL-Query Error

Post by W. Tucha » Thu, 07 May 1998 04:00:00


Quote:

> I'm faced with a strange problem when using the CDaoRecordset Open() or
> FindFirst() function with a SQL-query:
> Although the SQL-query is simple and absolutly correct, a CDaoException
> ('Syntax error in number in query expression!')is thrown when calling the
> function for the first time.
> After that, if I repeat the execution with exactly the same query,
> everthing works fine and I get my desired recordset.

Yes, the jet engine does this sometimes when useing a numerical expression
in a query. It's a well known and never fixed bug. Are you useing the
latest driver version? I have given up testing this bug against every new
version of the jet engine. The remedy is to retry until success.

 
 
 

CDaoRecordset : Strange SQL-Query Error

Post by Brian Kowal » Thu, 07 May 1998 04:00:00


Quote:>Yes, the jet engine does this sometimes when useing a numerical expression
>in a query. It's a well known and never fixed bug. Are you useing the
>latest driver version? I have given up testing this bug against every new
>version of the jet engine. The remedy is to retry until success.

I have found that I have to format my queries with parenthesis like this:

SELECT * FROM Users WHERE (group = 1) AND (x  =  x)

for numbers.

Brian

 
 
 

CDaoRecordset : Strange SQL-Query Error

Post by Robert Lechne » Tue, 19 May 1998 04:00:00



Quote:

> > I'm faced with a strange problem when using the CDaoRecordset Open() or
> > FindFirst() function with a SQL-query:
> > Although the SQL-query is simple and absolutly correct, a CDaoException
> > ('Syntax error in number in query expression!')is thrown when calling the
> > function for the first time.
> > After that, if I repeat the execution with exactly the same query,
> > everthing works fine and I get my desired recordset.

> Yes, the jet engine does this sometimes when useing a numerical expression
> in a query. It's a well known and never fixed bug.

The engine also throws an exception if a math error happens _before_ the call
to Open or FindFirst.

To solve this problem, derive a class from CDaoRecordset, overwrite Open and
FindFirst and derive all your recordsets from this class.

The new functions catch the CDaoException and call the original function a second
time.

--
---------------------------------------------------------------
--  Robert Lechner, University of Technology, Graz, Austria  --

---------------------------------------------------------------

 
 
 

1. strange behavior in SQL SP and SQL Query Analyzer

Hello!

I received this strange thing in SQL just now.

I'm having a SP which I created, and in SQL Query Analyzer i ran exec SPName
with the right parameter.

That takes over one minute, and still counts.

I took a copy of the select statement inside this SP, and changed the
parametername to the right one, and it took less then one sec.

If I inserted the right value inside the SP, it took less than a sec.

I'm confused here -

Lars

2. VB 3, Access 2.0 and Bound OLE Data ???

3. Strange error in query

4. Paradox V. 7 Report Problem - No Grids!

5. ConnectionCheckForData (strange query error)

6. Arranging Windows in FMP 5.0

7. Strange URL Query Error

8. table level locks

9. Query failing with strange error.

10. Strange error executing INSERT query on Oracle

11. strange error message from a query

12. QUERY HELP: Strange Error Mssg.