标题:关于VB中在查询中使用控件......
只看楼主
kieporzen
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-8-9
 问题点数:0 回复次数:0 
关于VB中在查询中使用控件......
大家好:
小弟是潜水很长时间的菜鸟......
请教前辈们一个问题:
我做了一个查询窗体,有两个comboBox,一个保存关键字(比如“序号”),另一个保存比较运算符(比如“like","<")。
Select Case Combo2.Text
Case Is = "like"

Data1.RecordSource = "select * from gzb where (gzb." & Combo1.Text & " " & "like " + Chr(34) + "*" + Text1.Text + "*" + Chr(34) + ")"
Case Is = "="
Data1.RecordSource = "select * from gzb where (gzb." & Combo1.Text & " " & "like " + Chr(34) + Text1.Text + Chr(34) + ")"
Case Is = ">"
Data1.RecordSource = "select * from gzb where (gzb." & Combo1.Text & " " & "like " + Chr(34) + Text1.Text + "*" + Chr(34) + ")"

Case Is = "<"
Data1.RecordSource = "select * from gzb where (gzb." & Combo1.Text & " " & "like " + Chr(34) + "*" + Text1.Text + Chr(34) + ")"
上面的代码有错误
不管选什么运算符,都是按like来的, 不应该都是like运算符,由于小弟有些菜得过分,请前辈们说得详细些......
还请详细说一下比如
Data1.RecordSource = "select * from gzb where (gzb." & Combo1.Text & " " & "like " + Chr(34) + Text1.Text + "*" + Chr(34) + ")"
里面各个组成的具体意思,有可能的话,尽量详细点。

给大家添麻烦了,谢谢!!!



搜索更多相关主题的帖子: 控件 查询 
2006-04-17 21:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-58141-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.182676 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved