文章分类 | 推荐文章 | 最新文章 | 热点文章 | 最新软件 | 精品软件 | 下载排行 | 推荐下载 | WPS | 杀毒软件
清风网络
首 页 软件下载 网络学院
QQ 电脑入门 游戏 操作系统 图形处理 办公软件 媒体动画 精文荟萃 工具软件 网络编程 程序开发 网络技术 认证考试 网站建设 文章专栏
当前位置:清风网络程序开发PowerBuilder在PB中如何实现数据模糊查询
精品推荐
特别推荐
·PowerBuilder实用技巧八则
热点TOP10
·在PB中用OLE存取blob类型数据
·PB8.0应用程序编译发布技术研究
·PowerBuilder应用开发系列讲座(32)
·PowerBuilder实用技巧八则
·PowerBuilder应用开发系列讲座(1)
·在pb中用语音读金额
·在PB中如何实现数据模糊查询
·使用XML技术实现OWC对数据库的展示
·PB代码优化
·PB/Sybase系统开发中的数据库转移

在PB中如何实现数据模糊查询

日期:2008年5月29日 作者: 查看:[大字体 中字体 小字体]


end if
sValue = inv_string.of_globalreplace(sValue,"'","") //去掉sValue中的单引号.
sValue = inv_string.of_globalreplace(sValue,'"','') //去掉sValue中的双引号.
sValue = inv_string.of_globalreplace(sValue,")","") //去掉sValue中的右括号.
sLog = GetItemString(i,"logical")
if sLog = "" or isNull(sLog) then
sLog = "and"
dw_where.SetItem(i,"logical","and")
end if
ywcol = wf_getYwName(hzcol) //表名.列名
sType = lower(wf_getYwType(hzcol))
CHOOSE CASE sType
CASE "char","character","string","nchar","nvarchar","varchar","time"
if trim(sOper) = "like" or trim(sOper) = "not like" then
sWhere += " (" + sLeft_kh + ywcol + sOper + "'%" + sValue + "%') " + sRight_kh + sLog
else
sWhere += " (" + sLeft_kh + ywcol + sOper + "'" + sValue + "') " + sRight_kh + sLog
end if
CASE "numeric","decimal","decimaln","dec","double","integer","int","smallint",&
"number","long","real","uint","ulong","unsignedint","unsignedinteger","unsignedlong"
if trim(sOper) = "like" or trim(sOper) = "not like" then
if MessageBox("提示信息",hzcol + "不是字符型,不能使用<含有>或<不含有>操作符," + &
"~r~n~r~n请改正; 否则,所有查询条件将被忽略。",None!,OKCancel!,2)=1 then
return 1
else
dw_where.setfocus()
return 0
end if
end if
if isNumber(sValue) then
sWhere += " (" + sLeft_kh + ywcol + sOper + sValue + ") " + sRight_kh + sLog
else
if MessageBox("综合查询输入错误",hzcol + "的值应为数字型,请改正;" + &
"~r~n~r~n否则,所有查询条件将被忽略。",None!,OKCancel!,2)=1 then
Return 1
else
dw_where.setfocus()
return 0
end if
end if
CASE "date","datetime","datetimn","smalldatetime","timestamp"
if trim(sOper) = "like" or trim(sOper) = "not like" then
if MessageBox("提示信息",hzcol + "不是字符型,不能使用<含有>或<不含有>操作符," + &
"~r~n~r~n请改正; 否则,所有查询条件将被忽略。",None!,OKCancel!,2)=1 then
return 1
else
dw_where.setfocus()
return 0
end if
end if
if sType = "date" then
if not isdate(sValue) then
if MessageBox("综合查询输入错误",hzcol + "的值应为日期型,请改正;" + &
"~r~n~r~n否则,所有查询条件将被忽略.",None!,OKCancel!,2)=1 then
Return 1
else
dw_where.setfocus()
return 0
end if
end if
sValue = wf_dateconvert(sValue)
sWhere += " (" + sLeft_kh + ywcol + sOper + "'" + sValue + "') " + sRight_kh + sLog
else
//datetime型的字段在sybase中转换为字符串的类型
sValue = wf_datetime(sValue)
if sValue = "error" then
if MessageBox("综合查询输入错误",hzcol + "的值应为日期时间型,请改正;" + &
"~r~n~r~n否则,所有查询条件将被忽略。",None!,OKCancel!,2)=1 then
Return 1
else
dw_where.setfocus()

上一页 [1] [2] [3] [4] [5] [6] [7] [8] 下一页 




上一篇:PowerBuilde应用开发系列讲座(15)续

下一篇:在PB中调用外部程序并判断其运行结束
相关文章:
·教你学习如何破解XP登陆密码
·“黑客”教你如何远程控制计算机
·如何刺激女性私处更有效
·[加点]教你如何合理分配剧情点
·教你如何复制别人的QQ空间
·如何实现局域网打印机共享
·教你如何打造一道超级防御的电脑防火墙
·不同宽带模式接入下的路由器如何设置
·木马是如何盗取QQ密码的?
·将系统装到U盘中 如何自制XP@USB启动盘
相关软件:

特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
[打印本页] [关闭窗口] 转载请注明来源:http://www.vipcn.net
| 帮助(?) | 版权声明 | 友情连接 | 关于我们 | 信息发布
Copyright 2007 www.vipcn.net All Rights Reserved. 鄂ICP备05000083号Powered by:viphot