vb6 - How to pass value to SQL Query in Data Environment's Command Object at run-time in Visual Basic 6.0? -
in dataenvironment have command object in have given following sql query:
select * userdetails date = todays_date
here todays_date
public variable in module. variable accepts value @ run-time.
how call variable in dataenvironment's sql query?
the vb6 manuals cover in closing , reopening recordset under heading data environment programming guidelines. example given there looks like:
option explicit private sub command1_click() ' must close recordset before changing parameter. if dataenvironment1.rscommandquery.state = adstateopen dataenvironment1.rscommandquery.close end if ' reopen recordset input parameter supplied ' textbox control. dataenvironment1.commandquery text1.text text2 .datafield = "au_lname" .datamember = "commandquery" set .datasource = dataenvironment1 end end sub private sub form_load() ' supply default value. text1.text = "172-32-1172" ' change commandbutton caption. command1.caption = "run query" end sub
you call command object method of parent dataenvironment, passing parameters there. gotta love fine manual.
Comments
Post a Comment