hi,
I'm new to MySQL/MyDAC and have a problem on how to
build a user query based on selections he makes using
2 dblookupcomboboxes. The listsource from each dblookupcombo
points to a ohter database.
The user selects in every dblookupcombobox a records to create
his selections. When he hits the ''Run'' button, the query has
to be executed.
Greetz Peter
Query based on 2 variables
Hi,
Oke..thanks, but where i'm looking for is the correct syntax and
how to build the query using the selected value from the
dblookupcombobox. Let's assume i have a dblookupcombobox
which points to a tables called function.
dblookupcombobox.listsource:= qryFunction
dblookupcombobox.listfield:=functionName
dblookupcombobox.keyfield:=functionID
(main table contains a field call FunID (integer)
Now i'm looking for the way to create a query using the selected value from the dblookupcombobox...do i need to use the keyvalue
for building the query, like :
myQuery.clear;
myQuery.SQL.Add('select * from test where funID= ' +chr(39) + dblookupcombobox.keyvalue
i can't figure out the correct syntax for doing this....
greetz Peter
Oke..thanks, but where i'm looking for is the correct syntax and
how to build the query using the selected value from the
dblookupcombobox. Let's assume i have a dblookupcombobox
which points to a tables called function.
dblookupcombobox.listsource:= qryFunction
dblookupcombobox.listfield:=functionName
dblookupcombobox.keyfield:=functionID
(main table contains a field call FunID (integer)
Now i'm looking for the way to create a query using the selected value from the dblookupcombobox...do i need to use the keyvalue
for building the query, like :
myQuery.clear;
myQuery.SQL.Add('select * from test where funID= ' +chr(39) + dblookupcombobox.keyvalue
i can't figure out the correct syntax for doing this....
greetz Peter
Code: Select all
Query.SQL.Clear;
Query.SQL.Add('select * from test where funID = :funID');
Query.ParamByName('funID').AsInteger := qryFunction.FieldByName('functionID').AsInteger;
Query.Open;
Code: Select all
Query.ParamByName('funID').AsInteger := qryFunction.FieldByName('functionID').AsInteger;
Query.Open;