Click to See Complete Forum and Search --> : How to pass parameters to a query in the DataEnvironment?


July 23rd, 1999, 06:16 AM
Hi,

How do I pass parameters to a query (Command Object) of a DataEnvironment? I am not being able to assign it in the Command Designer...

Specifically I want my query to be something like
SELECT fieldname1 FROM table1
WHERE
field2 = x;

where the value of x should be changeable at runtime.
And how do I build this query using the SQL builder applet?
The database I'm using is Oracle 8.

Thanks for your time.

freek
July 23rd, 1999, 07:00 AM
to build up your sql string you should do something like

sqlstring = "Select fieldname1 From table1 WHERE field2 = '" & x & "'"

you have to use the ' signs if field2 is a text file

Lothar Haensler
July 23rd, 1999, 07:13 AM
in the command designer write your sQL command like this:
select * from lahadr where name = ?

if necessary modify the attributes of that parameter in the parameters tab of the command dialog.

to pass that param in your vb code

de.Command1 "meier"
MsgBox de.rsCommand1.Fields(0)
de.rsCommand1.Close