为什么调试时候老提示语法错误呢

nicholas_yy 2003-12-12 04:31:01
string ls_sql
string ls_jfnd,ls_xm
ls_jfnd=trim(sle_1.text)
ls_xm=trim(sle_2.text)
if ls_jfnd<>"" and not isnull(ls_jfnd) then
ls_sql="c_yymx.bh='"+ls_jfnd+"'"
end if

if ls_xm<>"" and not isnull(ls_xm) then
if ls_sql="" or isnull(ls_sql) then
ls_sql="c_yymx.ypbh='"+ls_xm+"'"
else
ls_sql=ls_sql+" and c_yymx.ypbh='"+ls_xm+"'"
end if
end if
end if

dw_1.settransobject(sqlca)
IF dw_1.SetSQLSelect(ls_sql) = 1 THEN
dw_1.settransobject(sqlca)
dw_1.Filter()
ELSE
messagebox("系统提示","检索数据错误!")


我这程序有什么错误,怎么老提示语法错误呢
...全文
59 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
sinkiangscorpio 2003-12-13
  • 打赏
  • 举报
回复
dw_1.settransobject(sqlca)
IF dw_1.SetSQLSelect(ls_sql) = 1 THEN
dw_1.settransobject(sqlca)
dw_1.Filter()//这个地方应该为 retrieve,不是filter,不过好像也能实现。
此外就是dw_1.settransobject(sqlca)重复


to hyan(hyan):
楼上的说法好像不成立





hyan 2003-12-12
  • 打赏
  • 举报
回复
将 if ls_sql="" 的条件修改为 if ls_sql+"a"="a" 试试

好象PB不能使用使用“”
cxwsoftware 2003-12-12
  • 打赏
  • 举报
回复
end if
daiwoo_wang 2003-12-12
  • 打赏
  • 举报
回复
要 养成良好的习惯,在写一个IF的时候,马上写END IF ,然后在中间写东西,不要以为自己可以记得清。另外缩进很重要,良好的编程风格和习惯是必不可少的,否则你要付出很多代价
klbt 2003-12-12
  • 打赏
  • 举报
回复
end if时多时少,细心很重要。
mittee 2003-12-12
  • 打赏
  • 举报
回复
是保存的时候出现错误吧,
还有代码有一些问题。
string ls_oldsql
dw_1.settransobject(sqlca)
ls_oldsql = dw_1.getsqlselect()
ls_sql = ls_oldsql + "and " + ls_sql //注意数据窗口的sql语法是否有where,
//如果没有还要加上,不需要and
dw_1.SetSQLSelect(ls_sql)
dw_1.retrieve()
dw_1.SetSQLSelect(ls_oldsql)



Zhaoxf0201 2003-12-12
  • 打赏
  • 举报
回复
对啊,一个多了一个endif ,另一个少了一个end if
workhand 2003-12-12
  • 打赏
  • 举报
回复
注意语句的缩进,前面多了一个end if 后面少了一个end if 。
小子侯 2003-12-12
  • 打赏
  • 举报
回复
string ls_sql
string ls_jfnd,ls_xm
ls_jfnd=trim(sle_1.text)
ls_xm=trim(sle_2.text)
if ls_jfnd<>"" and not isnull(ls_jfnd) then
ls_sql="c_yymx.bh='"+ls_jfnd+"'"
end if

if ls_xm<>"" and not isnull(ls_xm) then
if ls_sql="" or isnull(ls_sql) then
ls_sql="c_yymx.ypbh='"+ls_xm+"'"
else
ls_sql=ls_sql+" and c_yymx.ypbh='"+ls_xm+"'"
end if
end if


dw_1.settransobject(sqlca)
IF dw_1.SetSQLSelect(ls_sql) = 1 THEN
dw_1.settransobject(sqlca)
dw_1.Filter()
ELSE
messagebox("系统提示","检索数据错误!")
END IF

lmby 2003-12-12
  • 打赏
  • 举报
回复
if ls_xm<>"" and not isnull(ls_xm) then
if ls_sql="" or isnull(ls_sql) then
ls_sql="c_yymx.ypbh='"+ls_xm+"'"
else
ls_sql=ls_sql+" and c_yymx.ypbh='"+ls_xm+"'"
end if
end if
end if//多了一个end if

1,108

社区成员

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

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