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;//關閉遊標
//**********