 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
PhilD Guest
|
Posted: Sun Dec 25, 2005 12:41 am Post subject: Help with a query modification. |
|
|
I am new to sql and delphi and I need some help working out the syntax
of a query.
Table is a paradox .db table and I am using Delphi 5 professional.
I would like to replace dog_name and the operator in the where
statement with
selections from 2 different comboboxes. This way I can pick the field
I
want to search on and the operator I want to use at runtime.
I want to change this:
XS1:=' where (upper(dog_name) Like "' +'%' +XStr +'%")'; // use
UpperCase cast
I want to change dog_name to use a field selected from combobox1 and an
operator from combobox2 to something like this or whatever is proper
syntax.
XS1:=' where (upper(combobox1.text) combobox2.text "' +'%' +XStr
+'%")';
Everything I have attempted so far fails and the person at work who is
helping me with
Delphi does not know how either.
procedure TForm3.Button2Click(Sender: TObject);
var
XStr, XS1 : string[100];
begin
// Do Query
XStr:=UpperCase(edit1.Text); // cast to all upper case
Query1.DisableControls;
Query1.Close;
Query1.SQL.Clear;
XS1:='select Title, Dog_Name, Gender from dogs_all.db D ';
Query1.SQL.Add(XS1);
XS1:=' where (upper(dog_name) Like "' +'%' +XStr +'%")'; // use
UpperCase cast
Query1.SQL.Add(XS1);
XS1:=' order by dog_name';
Query1.SQL.Add(XS1);
ShowMessage(query1.SQL.Text); //to see query string
Query1.Open;
Query1.EnableControls;
end;
Could someone help and show or explain what or how I need to do this?
Thanks,
PhilD
|
|
| Back to top |
|
 |
Riki Wiki Guest
|
Posted: Sun Jan 01, 2006 9:56 pm Post subject: Re: Help with a query modification. |
|
|
On 24 Dec 2005 16:41:36 -0800, PhilD wrote:
| Quote: | Could someone help and show or explain what or how I need to do this?
|
Hoi Phil
You need to repost your question on the Borland news server to make
everybody see it and possibly answer your question.
Take a look here:
<http://tinyurl.com/8m5nw>
which links to
<http://delphi.wikicities.com/wiki/Delphi_Newsgroups>
|
|
| 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
|
|