BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TQuery parameters are listed 8 times.

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Tom Byars
Guest





PostPosted: Tue Apr 18, 2006 11:03 am    Post subject: TQuery parameters are listed 8 times. Reply with quote



I have a TQuery which uses ODBC to query the data in a MS Access .mdb
database. The query consists of the UNION of 4 queries on 4 seperate tables.
Each of the 4 queries contain the line
WHERE (NOT :Min OR TBL_i.IntVal>=:Min) AND (NOT :Max OR TBL_i.IntVal<=:Max).

If I click on the Params property to bring up the 'Editing Query->Params'
box there are 8 Min and 8 Max parameters as opposed to one of each. If I set
Min and Max as follows
Query->ParamByName("Min")->AsInteger=Start;
Query->ParamByName("Max")->AsInteger=End;
then on opening the query I get the message "General SQL error,
{Microsoft][ODBC Microsoft Access Driver]. Too few parameters. Expected
17.".

Anyone know why TQuery duplicates the Min and Max 8 times to show 16
parameters or why the error message suggests 17 were expected? The query
itself works fine within MS Access where only the 2 expected parameter
values are asked to be input.
Back to top
Tom Byars
Guest





PostPosted: Wed Apr 19, 2006 10:03 pm    Post subject: Re: TQuery parameters are listed 8 times. Reply with quote



Seems the error message was caused by enclosing an Access function variable
in double quotes rather than single quotes. Worked OK after I changed that,
although I'm still at a loss as to why TQuery thinks there are 16
parameters.

Quote:
I have a TQuery which uses ODBC to query the data in a MS Access .mdb
database. The query consists of the UNION of 4 queries on 4 seperate
tables. Each of the 4 queries contain the line
WHERE (NOT :Min OR TBL_i.IntVal>=:Min) AND (NOT :Max OR
TBL_i.IntVal<=:Max).

If I click on the Params property to bring up the 'Editing Query->Params'
box there are 8 Min and 8 Max parameters as opposed to one of each. If I
set Min and Max as follows
Query->ParamByName("Min")->AsInteger=Start;
Query->ParamByName("Max")->AsInteger=End;
then on opening the query I get the message "General SQL error,
{Microsoft][ODBC Microsoft Access Driver]. Too few parameters. Expected
17.".

Anyone know why TQuery duplicates the Min and Max 8 times to show 16
parameters or why the error message suggests 17 were expected? The query
itself works fine within MS Access where only the 2 expected parameter
values are asked to be input.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.