 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Tom Byars Guest
|
Posted: Tue Apr 18, 2006 11:03 am Post subject: TQuery parameters are listed 8 times. |
|
|
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
|
Posted: Wed Apr 19, 2006 10:03 pm Post subject: Re: TQuery parameters are listed 8 times. |
|
|
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 |
|
 |
|
|
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
|
|