新手入门问题----2

supsuccess 2002-04-02 10:02:33
win2000+pb6.5+odbc+sqlserver6.5
出错语句:
select bl into :grbl from szltm where code=:sfxm;
出错信息:SQLCA.SQLCODE=-1
SQLCA.SQLERRTEXT:无效SQL数据类型
表:SZLTM,其中:code(char(2)),bl(numeric(3,2))
PB变量:sfxm(string),grbl(dec)
...全文
54 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
cdqy 2002-04-11
  • 打赏
  • 举报
回复
怎么这样叛断游标???
open h_cur;
DO WHILE (sqlca.sqlcode <> 100) and (sqlca.sqlcode <> -1)
supsuccess 2002-04-09
  • 打赏
  • 举报
回复
哎,算了,结帖!
supsuccess 2002-04-02
  • 打赏
  • 举报
回复
大家辛苦了,就是下面的:
decimal ljje,grcdlj,grxe,grbl,dwbl,dwcd,syje,h_ljje,h_grcdlj
string zw,sfxm
long bsl,tempbsl
...
declare h_cur cursor for select bsl,smon,itm,mpay from cbgfmx where bsl>:bsl order by bsl;
open h_cur;
string flag
flag='true'
do while flag='true'
fetch h_cur into :tempbsl,:ssje,:sfxm,:mpay;
if sqlca.sqlcode=0 then
flag='true'
elseif sqlca.sqlcode<0 then
flag='false'
rollback using sqlca;
messagebox(star,'数据库游标操作错误')
return
else
flag='false'
end if
if flag='false' then exit
select szltm.bl into :grbl from szltm where code = :sfxm;//出错地点!
if sqlca.sqlcode<>0 then
messagebox('star','取个人比例错误'+string(sqlca.sqlcode)+sqlca.sqlerrtext)
rollback;
return
end if
....
loop
CLOSE h_cur;
supsuccess 2002-04-02
  • 打赏
  • 举报
回复
有数据,表没问题
sorrow_arrow 2002-04-02
  • 打赏
  • 举报
回复
你这个sql语句没有什么问题呀,我估计是在游标那里的返回值出错了,不要用游标换成datastore试试
sorrow_arrow 2002-04-02
  • 打赏
  • 举报
回复
比如说sfxm等于;'aa',你就在sql server里面执行一下下面的语句试试,看有没有数据:

select bl from szltm where code='aa';
supsuccess 2002-04-02
  • 打赏
  • 举报
回复
SQL语句中的数据类型都对!
另外,我的sfxm变量值是丛游标中取得的,我跟踪它,发现一切正常;
我把这句代码放到另外一个库中去测试,直接给sfxm附值,结果没问题!
cdqy 2002-04-02
  • 打赏
  • 举报
回复
代码的多少跟这无关。
先试试这条语句:
select * from szltm where code=:sfxm;
如果能通过,说明表没问题。这个变量类型也没问题。那就是另一个变量的问题。如果通不过就有可能是表的问题。把表重建试试。
钟伟海 2002-04-02
  • 打赏
  • 举报
回复
和代码长度是没关系的,
应该是数据库的问题,SQL语句中的数据类型都对吗?
supsuccess 2002-04-02
  • 打赏
  • 举报
回复
另外,我这个按钮中的代码大约有300多行,跟这有关系吗?
supsuccess 2002-04-02
  • 打赏
  • 举报
回复
TO: sydeng(dssdf)
谢谢老兄参与,但是问题依然...
supsuccess 2002-04-02
  • 打赏
  • 举报
回复
着急,请各位高手赐教,解决马上给分,在线等待...
sydeng 2002-04-02
  • 打赏
  • 举报
回复
select szltm.bl into :grbl from szltm where szltm.code=:sfxm;

1,075

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧