>Is there a rule of parameter substitution I'm breaking here ?
Afraid so. Parameters can only replace data values, not column names or
SQL keywords, including ",". Since IDList is a string type, your
parameter substitution will be executed as
SELECT * FROM TABLE
WHERE ID IN ("2,3")
Options:
1/. Build your query dynamically and don't use parameters - just plug in
the values directly as you build the query
2/. Have two queries, one for the one parameter case and one for the two
parameter case
3/. Have one query:
SELECT * FROM TABLE
WHERE ID IN (:ID1, :ID2)
and if you have only one parameter to set, repeat it or set the second
to a constant (eg. null, -1)
4/. Don't have a where clause - use a Filter instead
I suggest either 1 for neatness or 2 for speed.
Cheers,
Carl Reynolds Ph: +64-9-4154790
CJN Technologies Ltd. Fax: +64-9-4154791
[EMAIL PROTECTED] DDI: +64-9-4154795
PO Box 302-278, North Harbour, Auckland, New Zealand
12 Piermark Drive, North Harbour Estate, Auckland, NZ
Visit our website at http://www.cjntech.co.nz/
> -----Original Message-----
> From: Andrew Masters [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, April 20, 1999 5:57 PM
> To: Multiple recipients of list delphi
> Subject: [DUG]: Query Parameters
>
> Hi All,
>
> I have a query (simplified here) like
>
> SELECT * FROM TABLE
> WHERE ID IN (:IDList)
>
> Under WISQL something like
>
> SELECT * FROM TABLE
> WHERE ID IN (2,3)
>
> works just fine. In my code if I set the param :IDList to say '2,3' it
> does not work (returns nothing but no exception either). When set to
> say '2' or '3' it works just fine. The IDList parameter is a string
> type. Is there a rule of parameter substitution I'm breaking here ?
>
> Thanks
> Andrew Masters
> Clinical Solutions Ltd
> Auckland, NZ
> Ph: +64-9-476-0106
> Fax: +64-9-476-0108
> e: [EMAIL PROTECTED]
>
application/ms-tnef