string s_user_number,s_user_name
SELECT T_user.user_name
INTO :s_user_name
FROM T_user ;
ddlb_user_name.reset()
ddlb_user_name.additem(s_user_name)
这样做,只是把第一条记录放入到DropDownListBox中,是不是要用循环或数组呢,多谢大家了!
7 个解决方案
#1
要先定義一個游標
用一個循环從游標中取值,并ddlb_user_name.additem(s_user_name)
用一個循环從游標中取值,并ddlb_user_name.additem(s_user_name)
#2
用游标,循环取数!
#3
SELECT 语句只能检索第一条符合条件的语句,要检索多条纪录,用游标实现,或者建一个数据存储吧
#4
能具体一些么,能不能给段代码看看呢,多谢了
#5
declare get_user cursor for
select user_name from t_user;
Open get_user;
Fetch get_user Into :s_user_name;
Do While SQLCA.SQLCODE = 0
ddlb_user_name.additem(s_user_name)
Fetch get_user Into :s_user_name;
Loop
Close get_user;
select user_name from t_user;
Open get_user;
Fetch get_user Into :s_user_name;
Do While SQLCA.SQLCODE = 0
ddlb_user_name.additem(s_user_name)
Fetch get_user Into :s_user_name;
Loop
Close get_user;
#6
//以一个表名为linkman的表为例
int li_linkmanid[]
//定义游标
declare linkman_cur cursor for
select id,secret_dgr from linkman where client_id = :li_id
using sqlca;
打开游标
open linkman_cur;
do
//从select语句中提出一条纪录
fetch linkman_cur into :li_linkmanid[i],:li_link_secret;
if sqlca.sqlcode = 0 then
if sqlca.sqlnrows = 0 then
messagebox('','select over')
exit
else
messagebox('',select success')
end if
end if
i += 1
loop until sqlca.sqlcode = 100
//关闭游标
close linkman_cur;
int li_linkmanid[]
//定义游标
declare linkman_cur cursor for
select id,secret_dgr from linkman where client_id = :li_id
using sqlca;
打开游标
open linkman_cur;
do
//从select语句中提出一条纪录
fetch linkman_cur into :li_linkmanid[i],:li_link_secret;
if sqlca.sqlcode = 0 then
if sqlca.sqlnrows = 0 then
messagebox('','select over')
exit
else
messagebox('',select success')
end if
end if
i += 1
loop until sqlca.sqlcode = 100
//关闭游标
close linkman_cur;
#7
多谢大家了!不过现在情况又变了,是利用存储过程产生的记录集,我下面的做法不知错在什么地方,大家帮忙再看看吧,多谢了!
string s_user_name,s_user_number
DECLARE emp_proc PROCEDURE FOR sp_user04;
declare c1 cursor for
open c1;
execute emp_proc;
fetch c1 into :s_user_number,:s_user_name;
do while sqlca.sqlcode=0
ddlb_user_number.additem(s_user_number)
ddlb_user_name.additem(s_user_name)
fetch c1 into :s_user_number,:s_user_name;
loop
close c1;
string s_user_name,s_user_number
DECLARE emp_proc PROCEDURE FOR sp_user04;
declare c1 cursor for
open c1;
execute emp_proc;
fetch c1 into :s_user_number,:s_user_name;
do while sqlca.sqlcode=0
ddlb_user_number.additem(s_user_number)
ddlb_user_name.additem(s_user_name)
fetch c1 into :s_user_number,:s_user_name;
loop
close c1;
#1
要先定義一個游標
用一個循环從游標中取值,并ddlb_user_name.additem(s_user_name)
用一個循环從游標中取值,并ddlb_user_name.additem(s_user_name)
#2
用游标,循环取数!
#3
SELECT 语句只能检索第一条符合条件的语句,要检索多条纪录,用游标实现,或者建一个数据存储吧
#4
能具体一些么,能不能给段代码看看呢,多谢了
#5
declare get_user cursor for
select user_name from t_user;
Open get_user;
Fetch get_user Into :s_user_name;
Do While SQLCA.SQLCODE = 0
ddlb_user_name.additem(s_user_name)
Fetch get_user Into :s_user_name;
Loop
Close get_user;
select user_name from t_user;
Open get_user;
Fetch get_user Into :s_user_name;
Do While SQLCA.SQLCODE = 0
ddlb_user_name.additem(s_user_name)
Fetch get_user Into :s_user_name;
Loop
Close get_user;
#6
//以一个表名为linkman的表为例
int li_linkmanid[]
//定义游标
declare linkman_cur cursor for
select id,secret_dgr from linkman where client_id = :li_id
using sqlca;
打开游标
open linkman_cur;
do
//从select语句中提出一条纪录
fetch linkman_cur into :li_linkmanid[i],:li_link_secret;
if sqlca.sqlcode = 0 then
if sqlca.sqlnrows = 0 then
messagebox('','select over')
exit
else
messagebox('',select success')
end if
end if
i += 1
loop until sqlca.sqlcode = 100
//关闭游标
close linkman_cur;
int li_linkmanid[]
//定义游标
declare linkman_cur cursor for
select id,secret_dgr from linkman where client_id = :li_id
using sqlca;
打开游标
open linkman_cur;
do
//从select语句中提出一条纪录
fetch linkman_cur into :li_linkmanid[i],:li_link_secret;
if sqlca.sqlcode = 0 then
if sqlca.sqlnrows = 0 then
messagebox('','select over')
exit
else
messagebox('',select success')
end if
end if
i += 1
loop until sqlca.sqlcode = 100
//关闭游标
close linkman_cur;
#7
多谢大家了!不过现在情况又变了,是利用存储过程产生的记录集,我下面的做法不知错在什么地方,大家帮忙再看看吧,多谢了!
string s_user_name,s_user_number
DECLARE emp_proc PROCEDURE FOR sp_user04;
declare c1 cursor for
open c1;
execute emp_proc;
fetch c1 into :s_user_number,:s_user_name;
do while sqlca.sqlcode=0
ddlb_user_number.additem(s_user_number)
ddlb_user_name.additem(s_user_name)
fetch c1 into :s_user_number,:s_user_name;
loop
close c1;
string s_user_name,s_user_number
DECLARE emp_proc PROCEDURE FOR sp_user04;
declare c1 cursor for
open c1;
execute emp_proc;
fetch c1 into :s_user_number,:s_user_name;
do while sqlca.sqlcode=0
ddlb_user_number.additem(s_user_number)
ddlb_user_name.additem(s_user_name)
fetch c1 into :s_user_number,:s_user_name;
loop
close c1;