PB带参数带结果集的动态SQL查询

 

strSelectedDepartment=Trim(parent.cb_department.text)
string strSelectedDepartmentCode

//************
string strSQL
strSQL="select bmbh from pub_bm where bmmc= ?"
declare cr dynamic cursor for SQLSA;
prepare SQLSA from :strSQL;
open dynamic cr using :strSelectedDepartment;
Label:
fetch cr into :strSelectedDepartmentCode;
if SQLCA.SQLCode=0 then//如果成功取出记录
//进行相应处理
goto Label//取下一条
end if

close cr;//关闭游标
//**********

 

posted @ 2011-01-15 14:36  quietwalk  阅读(2040)  评论(0编辑  收藏  举报