TA的每日心情 | 慵懒 2022-7-23 11:23 |
---|
签到天数: 316 天 连续签到: 1 天 [LV.8]测试军长
|
下面以oracle数据库为例:
Action()
{
intNumRows=0;
inti=1;
//建立数据库连接
lr_db_connect("StepName=DatabaseConnection",
"ConnectionString=Provider=OraOLEDB.Oracle.1assword = test ersist Security Info=True; User ID = test ; Data Source = betadb ; Server = 172.19.188.191",
"ConnectionName=InvDatabaseConnection",
"ConnectionType=OLEDB",
LAST);
//执行SQL语句
NumRows=lr_db_executeSQLStatement("StepName=PerformQuery",
"ConnectionName=InvDatabaseConnection",
"SQLStatement=SELECT cons_no,cons_id FROM c_cons where rownum<10",
"DatasetName=MyDataset",
LAST);
lr_output_message("The query returned %d rows.", NumRows);
//打印出结果
lr_db_dataset_action("StepName=PrintDataset",
"DatasetName=MyDataset",
"Action=PRINT",
LAST);
//利用循环检索数据值
while(i<10) {
lr_db_getvalue("StepName=GetValue",
"DatasetName=MyDataset",
"Column=CONS_NO",
"Row=next",
"OutParam=MyOutputParam",
LAST);
lr_output_message("The value is: %s", lr_eval_string("{MyOutputParam}") );
i=i+1; }
//释放结果
lr_db_dataset_action("StepName=RemoveDataset",
"DatasetName=MyDataset",
"Action=REMOVE",
LAST);
//断开数据库连接
lr_db_disconnect("StepName=Disconnect",
"ConnectionName=InvDatabaseConnection",
LAST);
return0;
} |
评分
-
查看全部评分
|