| View previous topic :: View next topic |
| Author |
Message |
jack Guest
|
Posted: Sat Feb 05, 2005 4:03 am Post subject: how to make 2 parameters same |
|
|
in an AdoQuery, my sql is:
select id from table1
where name = :aName
union
select id from table2
where name = :aName
and in the object inspector, I got 2 'aName' parameters in Parameters
property altough the name is same.
my question is: how to make them into one parameter?
thanks a lot
jack
|
|
| Back to top |
|
 |
John Leavey Guest
|
Posted: Mon Feb 07, 2005 10:33 am Post subject: Re: how to make 2 parameters same |
|
|
jack wrote:
| Quote: | in an AdoQuery, my sql is:
select id from table1
where name = :aName
union
select id from table2
where name = :aName
and in the object inspector, I got 2 'aName' parameters in Parameters
property altough the name is same.
my question is: how to make them into one parameter?
thanks a lot
jack
|
Use a local variable to hold the parameter value
declare @aName char(20)
select @aName = :aName
select id from table1
where name = @aName
union
select id from table2
where name = @aName
John Leavey
|
|
| Back to top |
|
 |
Zhuo Guest
|
Posted: Thu Feb 24, 2005 6:22 pm Post subject: Re: how to make 2 parameters same |
|
|
The ADOQuery does support. Its method parambyname doesn't support but
parameters[i] supports. Bind the parameter by parameter index not by name
(refer to ADODB.pas). Or you can modify ADODB.pas to make parambyname work
too.
Zhuo
"Brian Bushay TeamB" <BBushay (AT) Nmpls (DOT) com> wrote
| Quote: |
in an AdoQuery, my sql is:
select id from table1
where name = :aName
union
select id from table2
where name = :aName
and in the object inspector, I got 2 'aName' parameters in Parameters
property altough the name is same.
my question is: how to make them into one parameter?
Unfortunately TadoQuery does not support using a parameter name more than
once
--
Brian Bushay (TeamB)
[email]Bbushay (AT) NMPLS (DOT) com[/email]
|
|
|
| Back to top |
|
 |
|