哈尔滨工业大学(威海)数据库系统课程设计报告 end if
do while true
fetch r_cursor //取数到自己定义的变量中 into :r_id, :r_kind, :r_bed, :r_price, :r_status, :r_describe; if sqlca.sqlcode<>0 then
exit end if
lv_id.additem(string(r_id), t) lv_id.setitem(t, 2, string(r_kind)) lv_id.setitem(t, 3, string(r_bed)) lv_id.setitem(t, 4, string(r_price)) lv_id.setitem(t, 5, string(r_status)) lv_id.setitem(t, 6, string(r_describe)) t=t+1
loop //循环 close r_cursor; //关闭游标
2,按类别查询
string r_id, r_kind, r_bed, r_price,r_status, r_describe string r_kindi int t=1
if ddlb_kind.text=\
12 / 50
哈尔滨工业大学(威海)数据库系统课程设计报告
messagebox(\请选择房间类型!\return
end if
r_kindi=trim(ddlb_kind.text)
lv_kind.deleteitems() //清空lv控件
declare r_cursor cursor for //定义游标 select * from room
where room.r_kind=:r_kindi;
open r_cursor; if sqlca.sqlcode<>0 then messagebox(\提示\游标打开错误!\end if
do while true fetch r_cursor into :r_id, :r_kind, :r_bed, :r_price, :r_status, :r_describe; if sqlca.sqlcode<>0 then
exit end if
lv_kind.additem(string(r_id), t) lv_kind.setitem(t, 2, string(r_kind)) lv_kind.setitem(t, 3, string(r_bed)) lv_kind.setitem(t, 4, string(r_price)) lv_kind.setitem(t, 5, string(r_status)) lv_kind.setitem(t, 6, string(r_describe))
t=t+1
loop close r_cursor;
3,按床位查询 13 / 50
//打开游标 //取数到自己定义的变量中 //循环 //关闭游标 哈尔滨工业大学(威海)数据库系统课程设计报告
string b_id, b_kind, b_bed, b_price,b_status, b_describe string r_bedi int t=1
if sle_bed.text=\
messagebox(\请输入床位数!\return
end if
r_bedi=trim(sle_bed.text)
lv_bed.deleteitems() //清空lv控件
declare r_cursor cursor for //定义游标 select * from room
where room.r_bed=:r_bedi;
open r_cursor; //打开游标 if sqlca.sqlcode<>0 then
do while true
fetch r_cursor //取数到自己定义的变量中 into :b_id, :b_kind, :b_bed, :b_price, :b_status, :b_describe; if sqlca.sqlcode<>0 then
exit
messagebox(\提示\游标打开错误!\end if
14 / 50
哈尔滨工业大学(威海)数据库系统课程设计报告
end if
lv_bed.additem(string(b_id), t) lv_bed.setitem(t, 2, string(b_kind)) lv_bed.setitem(t, 3, string(b_bed)) lv_bed.setitem(t, 4, string(b_price)) lv_bed.setitem(t, 5, string(b_status)) lv_bed.setitem(t, 6, string(b_describe)) t=t+1
loop //循环 close r_cursor; //关闭游标
4,按价格查询
string r_id, r_kind, r_bed, r_price,r_status, r_describe string r_pricei, r_pricej int t=1
if sle_low.text=\
messagebox(\请输入最低价!\return
end if
if sle_high.text=\
messagebox(\请输入最高价!\return
end if
15 / 50
相关推荐: