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 

how to make 2 parameters same

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
jack
Guest





PostPosted: Sat Feb 05, 2005 4:03 am    Post subject: how to make 2 parameters same Reply with 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


Back to top
John Leavey
Guest





PostPosted: Mon Feb 07, 2005 10:33 am    Post subject: Re: how to make 2 parameters same Reply with quote



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





PostPosted: Thu Feb 24, 2005 6:22 pm    Post subject: Re: how to make 2 parameters same Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) 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.