动态连接数据库代码怎么写。
lr_db_connect("StepName=Connect","ConnectionString=Provider=OraOLEDB.Oracle.1, Data Source=192.168.0.119:119:1521/tydb;Persist Security Info=True;User ID=tyrcptest;Password=tyrcptest",
"ConnectionName=tydb",
"ConnectionType=OLEDB",
LAST );
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);
return 0;
}
上面的代码报错,错误: C 解释器运行时错误: vuser_init.c (14):Error -- Unresolved symbol : lr_db_connect。 这样连接数据库要用web_service协议
页:
[1]