PB中实现dropdownlistbox和数据库绑定


string ls_temp
declare readdate dynamic cursor for sqlsa;
string ls_sql="select ROLENAME from T_ROLE"
prepare sqlsa from :ls_sql;
open dynamic readdate;
do while sqlca.sqlcode=0
fetch readdate into:ls_temp;
if sqlca.sqlcode=0 then
    tab_1.tabpage_1.ddlb_1.additem(ls_temp)
end if
loop
tab_1.tabpage_1.ddlb_1.SelectItem(2)
close readdate;

说明:这是PB中游标的一种高级应用,通过定义游标来循环读取数据集中的一行数据,然后把数据additem()加入dropdownlistbox中。