"ConnectionString=Provider=OraOLEDB.Oracle.1; Data Source=SID; Persist Security Info=True; User> "ConnectionName=db1",
"ConnectionType=OLEDB",
LAST );
4、执行sql语句,其中SQLStatement后面替换为自己需要执行的sql语句。
lr_db_executeSQLStatement("StepName=PerformQuery",
"ConnectionName=db1",
"SQLStatement=select SERIALNO from FLOW_TASK where objectno = '0000001'",
"DatasetName=MyDataset",
LAST );
5、从sql语句的执行的数据集中检索值:其中SERIALNO为步骤4中检索的字段名,SerialNo_1可以在脚本中当参数使用。
lr_db_getvalue("StepName=GetValue",
"DatasetName=MyDataset",
"Column=SERIALNO",
"Row=next",
"OutParam=SerialNo_1",
LAST );
6、得到的参数可以打印出来。
lr_output_message("The value is: %s", lr_eval_string("{SerialNo_1}") );
7、断开数据库连接。
lr_db_disconnect("StepName=Disconnect",
"ConnectionName=db1",
LAST );