ODBC Error : "Query is too complex" 
Author Message
 ODBC Error : "Query is too complex"

Hi there,

Tools         :- VC++(5.0),MFC
Database :-Dbase(IV),ODBC(32-Bit)
OS            :-Windows NT 4.0(sp3).

I am accesing the data in Dbase(IV) database from my application in VC++
using MFC (CRecordset class) and 32-bit ODBC.

If I update a table with less than 40 columns, the application works fine.
For the table having more than 40-columns, the application gives error as
"Query is too complex" while updation.

Has anybody come across this type of problem ? Any workaround on this ?

Help of any type on the above issue is highly appreciated.


Thanks in advance.
YOG



Thu, 19 Apr 2001 03:00:00 GMT  
 ODBC Error : "Query is too complex"
I came accross this problem a while ago, the only way I managed to get
around it was to restructure the database. Instead of saving individual
member variables of my class, I serialized the the entire object into a BLOB
field.(I was using Access).
Quote:
>I am accesing the data in Dbase(IV) database from my application in VC++
>using MFC (CRecordset class) and 32-bit ODBC.

>If I update a table with less than 40 columns, the application works fine.
>For the table having more than 40-columns, the application gives error as
>"Query is too complex" while updation.

>Has anybody come across this type of problem ? Any workaround on this ?

>Help of any type on the above issue is highly appreciated.


>Thanks in advance.
>YOG




Fri, 20 Apr 2001 03:00:00 GMT  
 ODBC Error : "Query is too complex"
ARGGGH!!!!

This problem has been around for ages (i.e. since VC++ 1.5x).

We had the similar problem. We checked MSDN and found out that the behaviour
was "by design", meaning that they intended to do it this way, they don't
consider it a bug, and won't fix it.

The problem is in the way MFC recordsets handle updates. ODBC can handle
"positioned updates". If you peruse the recordset code (at least the 16-bit
source) you will find that select statements have "FOR UPDATE" appended.
When the recordset needs to perform an update, an SQL statement is created,
and the string "WHERE CURRENT OF ..." is appended. This is saying to ODBC to
update the table according to the current SQL cursor for the select
statement.

UNFORTUNATELY, the ODBC cursor library gets in the way (ODBCCURS.DLL in the
16 bit world). It removes the "WHERE CURRENT OF...." and replaces it with a
where clause containing the names of all the columns bound in the recordset
and their old (i.e. pre-update) values.  The where clause will look
something like "WHERE X =whatever AND Y = whatever AND Z = whatever ...
repeated for as many different columns are in the recordset.

The DBASE (and Access) driver has a restriction of up to 40 components in
the WHERE clause (i.e. up to 40 AND X=whatever). This is the source of your
problem.

Solution: You could overload the update code for CRecordset to only use the
primary key values (this is difficult but doable)

Otherwise you're pretty much resigned to breaking the recordset into several
smaller ones to avoid the problem.

;)

Quote:
>Hi there,

>Tools         :- VC++(5.0),MFC
>Database :-Dbase(IV),ODBC(32-Bit)
>OS            :-Windows NT 4.0(sp3).

>I am accesing the data in Dbase(IV) database from my application in VC++
>using MFC (CRecordset class) and 32-bit ODBC.

>If I update a table with less than 40 columns, the application works fine.
>For the table having more than 40-columns, the application gives error as
>"Query is too complex" while updation.

>Has anybody come across this type of problem ? Any workaround on this ?

>Help of any type on the above issue is highly appreciated.


>Thanks in advance.
>YOG




Sun, 22 Apr 2001 03:00:00 GMT  
 ODBC Error : "Query is too complex"
Hi yog,

I saw the same mess(age) when recently working
with an Access7 .mdb file.
The table was perfect in MS-Access, but erroneous in
ODBC-CRecordset usage.
Solution: split the table.

Michael


Quote:
>Hi there,

>Tools         :- VC++(5.0),MFC
>Database :-Dbase(IV),ODBC(32-Bit)
>OS            :-Windows NT 4.0(sp3).

>I am accesing the data in Dbase(IV) database from my application in VC++
>using MFC (CRecordset class) and 32-bit ODBC.

>If I update a table with less than 40 columns, the application works fine.
>For the table having more than 40-columns, the application gives error as
>"Query is too complex" while updation.

>Has anybody come across this type of problem ? Any workaround on this ?

>Help of any type on the above issue is highly appreciated.


>Thanks in advance.
>YOG




Mon, 30 Apr 2001 03:00:00 GMT  
 ODBC Error : "Query is too complex"
Hold on

I came across this in Access 2.o some time ago. It was a regular enough
message
Here is what worked for me

Create a new form on a table that does not give problems.

Then change the sources of the form from the table to the complex query.
Now design the form to show the output of the fields as you require either
tabular or a record at a time
Next run the form and it should now run the query without stopping.
But should you try to run the query on it own you will still get this
error!!

Its unbelievable but try it  it worked for me

Regards

Gerry (3 years on access and I love it)

Quote:

>Hi yog,

>I saw the same mess(age) when recently working
>with an Access7 .mdb file.
>The table was perfect in MS-Access, but erroneous in
>ODBC-CRecordset usage.
>Solution: split the table.

>Michael


>>Hi there,

>>Tools         :- VC++(5.0),MFC
>>Database :-Dbase(IV),ODBC(32-Bit)
>>OS            :-Windows NT 4.0(sp3).

>>I am accesing the data in Dbase(IV) database from my application in VC++
>>using MFC (CRecordset class) and 32-bit ODBC.

>>If I update a table with less than 40 columns, the application works fine.
>>For the table having more than 40-columns, the application gives error as
>>"Query is too complex" while updation.

>>Has anybody come across this type of problem ? Any workaround on this ?

>>Help of any type on the above issue is highly appreciated.


>>Thanks in advance.
>>YOG




Thu, 10 May 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. ODBC Error : "Query is too complex"

2. ODBC Error : "Query is too complex"

3. ODBC Error : "Query is too complex"

4. ODBC: "Multiple rows were updated" ERROR

5. ODBC Error - "Restricted data type attribute violation", code 07006

6. Error "free"-ing "malloc"-ed memory

7. "query is too complex" message from ODBC Microsoft Access 7.0 Driver

8. Weird "Querry To Complex"

9. Using the "complex" template

10. I am going to study "C"

11. append mode "a" query

12. Append mode ("a") query

 

 
Powered by phpBB® Forum Software