pb急待解决,各位大虾:赶快帮忙!

xinyue 2000-08-15 06:04:00
各位大虾:赶快帮忙!
我用pb,后台为informix,我在pb的dw中使用如下语句
dw.setsqlselect(str)
其中str="select 字段名 from 表名 where "+tmp
tmp="字段名="+变量
如上的语句在查询变量不出现中文时没有错误,但有中文是则出现非法字符提示框,请问怎么解决此问题!
...全文
141 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
linlin 2000-08-20
  • 打赏
  • 举报
回复
对不起,久没用,好象有点问题,如果上面的句子不行,试试下面的语句:
str=str+" and "+"birthday=Date("+string(tmpdate,"yyyy-mm-dd")+")"

这些语句跟具体的数据库有关,但都差不多,可自己试试。
linlin 2000-08-20
  • 打赏
  • 举报
回复
在SQL语句中对日期进行判断,要用数据库支持的Date函数
例如在SqlAnywhere 中是Date()

str=str+" and "+"Date(birthday)="+"Date("+string(tmpdate,"yyyy-mm-dd")+")"

在Oracle 中是To_date()。
xinyue 2000-08-18
  • 打赏
  • 举报
回复
如下程序:查询语句中包含中文,datawindow报错!
tmpdate=ta.search.dw_search.getitemdate(ins,"birthday")
if not isnull(tmpstr) then
str=str+" and "+"birthday='"+string(tmpdate,"yyyy-mm-dd")+"'"
end if
tmpdate=ta.search.dw_search.getitemdate(ins,"build_date")
if not isnull(tmpstr) then
str=str+" and "+"build_date='"+string(tmpdate,"yyyy-mm-dd")+"'"
end if
str="select * from pati_base_info where "+str
dw_amendmz.setsqlselect(str)
dw_amendmz.retrieve()
wwwunix 2000-08-16
  • 打赏
  • 举报
回复
我也是用PB+Informix没有这个问题.不过我的后台Informix设置成可支持中文的.另:出现非法字符提示框,是PB报的错还是Informix返回的SQL错误代码?
xinyue 2000-08-15
  • 打赏
  • 举报
回复
没有用的,其实不是这方面的问题,请继续解答,当我用odbc设置连接后可以查询汉字
但,odbc会经常断裂,需要经常连接,因此这不是一个有效的方法,请问怎样设置后台或
更深层次的解答.
hyzx2000 2000-08-15
  • 打赏
  • 举报
回复
tmp="字段名='"+变量+"'"

1,075

社区成员

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

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