给点提示,又遇谜题

xcwonder 2001-09-05 03:41:45
我做了一个查询,分别是根据号码、姓名、地点查询,但是只有号码能正常得到结果。
而号码全部都是数字,姓名和地点全部都是汉字,是不是因为这个原因所以搞不定呢?
代码如下:
if sle_1.text<>"" then
string column,old
integer j,i
column=dw_1.getsqlselect()
old=column

choose case string(ddlb_1.text)
case "姓名"
column+="where xingming = '" +sle_1.text+"'"
dw_1.setsqlselect(column)

case "号码"
column+="where haoma ='" +sle_1.text+"'"
dw_1.setsqlselect(column)

case "地点"
column+="where didian ='" +sle_1.text+"'"
dw_1.setsqlselect(column)
end choose

j=dw_1.retrieve(column)
dw_1.setsqlselect(old)
if j=0 then
messagebox("查找","所查记录不存在!")
end if
else
MessageBox("提示","请输入查询内容!")
end if
...全文
3269 32 打赏 收藏 转发到动态 举报
写回复
用AI写文章
32 条回复
切换为时间正序
请发表友善的回复…
发表回复
Only_I 2001-09-09
  • 打赏
  • 举报
回复
case应该是int吧
YHW 2001-09-08
  • 打赏
  • 举报
回复
gz
rami 2001-09-07
  • 打赏
  • 举报
回复
我觉得是中文支持方面的原因。在vb中有个参数专门对付中文。Pb我不熟,你可以查查资料。
lico 2001-09-07
  • 打赏
  • 举报
回复
你把case 改成if来判断,因为case的类型是string,

你用的语言我不熟,但是至少在c/c++里面,这样用是有问题的
xcwonder 2001-09-06
  • 打赏
  • 举报
回复
当然是定义了以后才问的,呵呵,至于数据类型是char。
liulee 2001-09-06
  • 打赏
  • 举报
回复
变量没有就定义一个啊。
string ls_where_clause
仔细检查一下数据库中是什么类型,和where条件中要匹配好。

xcwonder 2001-09-06
  • 打赏
  • 举报
回复
up
xcwonder 2001-09-06
  • 打赏
  • 举报
回复
up
xcwonder 2001-09-06
  • 打赏
  • 举报
回复
说的容易,我的库已经早就建好了,怎么改数据类型?
xiong058 2001-09-06
  • 打赏
  • 举报
回复
把char改成varchar即可.
xcwonder 2001-09-06
  • 打赏
  • 举报
回复
英文也行,就是中文不行,怎么办?
xcwonder 2001-09-06
  • 打赏
  • 举报
回复
斑竹,还是不对啊,
甚至有个提示告诉我没定义ls_where_clause
这段程序我是看懂拉,但是不明白他为什么就能解决:我觉得问题是数据类型的问题,因为我如果把姓名输入为数字时,查询一点问题都没有。
请详细说明一下!!!
tsl_first 2001-09-06
  • 打赏
  • 举报
回复
将汉字换成英文试一下!
xcwonder 2001-09-06
  • 打赏
  • 举报
回复
没有问题
xiong058 2001-09-06
  • 打赏
  • 举报
回复
一样的问题你怎么问几遍.在datawindow里检索出问题吗?
xcwonder 2001-09-06
  • 打赏
  • 举报
回复
up
liulee 2001-09-05
  • 打赏
  • 举报
回复
这样处理:
定义instance变量:
string is_orig_sql
open事件:
dw_xxx.settransobject(sqlca)
is_orig_sql = dw_xxx.getSqlSelect() //此语法中若有where条件,则需要修改下列脚本中的where
按钮事件:
string ls_where_clause = ' where (1=1) '
choose case .....
case "姓名"
ls_where_clause += ' and xingming like '%" +sle_1.text+"'% " //注意空格
case ...
ls_where_clause += ' and '+ ......
end choose
if ls_where_caluse = ' where (1=1) ' then return //没有条件
if is_orig_sql + ls_where_caluse = dw_xxx.getsqlselect() then return //没有变化
if dw_xxx.setSqlselect() = -1 then return //语法错误
dw_xxx.setredraw(false)
dw_xxx.settransobject(sqlca)
dw_xxx.retrieve()
dw_xxx.setredraw(true)

//搞定
cjh211 2001-09-05
  • 打赏
  • 举报
回复
up
cjh123 2001-09-05
  • 打赏
  • 举报
回复
up
xcwonder 2001-09-05
  • 打赏
  • 举报
回复
up
加载更多回复(12)

1,077

社区成员

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

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