标题:pb中sql的查询错误。。
只看楼主
55Pb
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-12-4
 问题点数:0 回复次数:2 
pb中sql的查询错误。。

初学pb,刚写了个查询程序
可是运行结果老是 “ 没有查找到相关记录!”
不知道为什么,达人 指点一下
string cno
string cname
string a
string xianxing
int score

a=sle_1.text
if ddlb_1.text="课程号" then
declare c cursor for
select course.课程号,course.课程名,course.先行课,course.学分
from course
where 课程号=:a;
open c;
do while true
fetch c into:cno,:cname,:xianxing,:score;
if sqlca.sqlcode=100 then
messagebox("注意!","没有查找到相关记录!")
exit
end if
loop
close c;
dw_1.settransobject(sqlca)

dw_1.retrieve()

end if

搜索更多相关主题的帖子: course cursor where 记录 
2006-12-04 22:48
55Pb
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-12-4
得分:0 
斑竹那。。
2006-12-04 22:52
werley
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-12-1
得分:0 

open c;
fetch c into:cno,:cname,:xianxing,:score;//把fetch加在这里第一次取
do while sqlca.sqlcode = 0 //条件
if sqlca.sqlcode=100 then
messagebox("注意!","没有查找到相关记录!")
exit
end if
fetch c into:cno,:cname,:xianxing,:score;;//fetch值控制LOOP
loop
close c;

2006-12-05 19:04



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-107275-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.438584 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved