[RESOLVED] Data Report:Setting commandText of DataEnvironment with parameters
Hi,
I'm currently using the Data Report facility of VB6 and am quite new to it.
Wondering how I can set the commandText of the command facility under the dataenvironment with variables I have passed into the report?
My commandText string of the command is like this:
SELECT * FROM tblcustomersection where RequestNo > '" & requestNoStart & "' and RequestNo < '" & requestNoEnd & "' order by RequestNo
requestNoStart and requestNoEnd are variables I've passed into the generated report but unfortunatley these don't seem to be picked up by the commandText.
Hope I'm doing something basic wrong.
Thanks.
Re: Data Report:Setting commandText of DataEnvironment with parameters
Hi actually solved this. The string should read:
SELECT * FROM tblcustomersection where RequestNo > ? and RequestNo < ? order by RequestNo
One can then right click on the sql statement in the data environment, select properties, and select the parameters tag. For each parameter set, it is picked up by a ?.
Then to pass the parameters to the sql statement it goes like this:
Assume the data environment is called 'data', and the command created is called 'command1', say the parameters created are 'param1' and 'param2'
Code: data.command1 param1,param2
My difficulty arose in the fact I couldn't understand why I couldn't set the parameters in the original sql statement.
Thanks for all replies and hope this has helped someone.