dropdownlistbox连接数据库
string ls_temp
declare readdate dynamic cursor for sqlsa;
string ls_sql="select tuzhiname from tuzhiinfo where userno=:sdf"
prepare sqlsa from :ls_sql;
open dynamic readdate;
do while sqlca.sqlcode=0
fetch readdate into:ls_temp;
if sqlca.sqlcode=0 then
ddlb_1.additem(ls_temp)
end if
loop
ddlb_1.SelectItem(1)
close readdate;
求助大家,以上代码连接了ddlb,但是“select tuzhiname from tuzhiinfo where userno=:sdf”
语句里的where条件里的":sdf"要怎样传进去。
[解决办法]
string ls_sdf //里面存你的参数
ls_sdf = "0001"
string ls_temp
declare readdate dynamic cursor for sqlsa;
string ls_sql="select tuzhiname from tuzhiinfo where userno='" + ls_sdf + "'"
prepare sqlsa from :ls_sql;
open dynamic readdate;
do while sqlca.sqlcode=0
fetch readdate into:ls_temp;
if sqlca.sqlcode=0 then
ddlb_1.additem(ls_temp)
end if
loop
ddlb_1.SelectItem(1)
close readdate;