当前位置:网站首页>SQL多条件查询无法实现
SQL多条件查询无法实现
2022-07-22 08:15:00 【CSDN问答】
On Error Resume Next
Dim i As Integer, j As Integer
Dim sql1 As String
Dim sql2 As String
Dim sql3 As String
Dim sql4 As String
With conn
.ConnectionString = "Provider=microsoft.ace.oledb.12.0;data source=" & ThisWorkbook.Path & "\价格评估管理系统.accdb"
.Open
End With
sql1 = "select * from 估价信息汇总 where (图号 like '%" & aa1.Value & "%') Or (名称 like '%" & aa1.Value & "%') or (毛坯X like '%" & aa1.Value & "%')"'sql2 = "select * from 估价信息汇总 where (毛坯X like '%" & aa2.Value & "%')"'sql3 = "select * from 估价信息汇总 where (毛坯Y like '%" & aa3.Value & "%')"'sql4 = "select * from 估价信息汇总 where (毛坯Z/直径 like '%" & aa4.Value & "%')"'sql = "select * from 估价信息汇总 where 图号 like '%" & aa1.Value & "%'"'or (毛坯X like '%" & aa2.Value & "%') or (毛坯Y like '%" & aa3.Value & "%')or(毛坯Z like '%" & aa4.Value & "%')rs.Open sql1, conn, adOpenKeyset, adLockOptimisticrs.Open sql2, conn, adOpenKeyset, adLockOptimisticrs.Open sql3, conn, adOpenKeyset, adLockOptimisticrs.Open sql4, conn, adOpenKeyset, adLockOptimistic
如图片所示,有4个条件输入框,第一个输入图号和名称可以查询,第二、三、四输入X,Y,Z查询数据,我想实现的是四个查询条件能够相互过滤查询,即输入“盖板”过滤后再输入X,Y,Z依次过滤,也能先输入X,Y,Z数值过滤后再输入“盖板”也能过滤查询,相互嵌套查询,哪位指点一下该怎么做?目前只能实现sql1的过滤效果,后面的实现不
版权声明:本文为CSDN博主「weixin_44370039」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_44370039/article/details/125808305
边栏推荐
- [exception] generate guid and datetime, import test data to the database
- 基于流谱理论的SSL/TLS协议攻击检测方法
- 《微信小程序-进阶篇》Lin-ui组件库的安装与引入
- Maintenance of gbase8s database constraint mode
- Understanding and learning of arrays class
- Gbase8s database makes the current connection a dormant connection
- How MySQL queries the data in JSON data
- Gbase8s database comparison performed by database objects
- 逆袭黑马:数据库全栈工程师(DevDBOps)培训,把最好的课程送给您!
- JS String charAt substring() substr slice toUpperCase toLowerCase indexOf
猜你喜欢
QT笔记——QTableWidget 之 指定某列排序
在线XML转CSV工具
[exception] generate guid and datetime, import test data to the database
【Rust】我该用什么软件开发 Rust | 常用支持 Rust 的编辑器推荐
会议OA项目之会议发布功能
线性回归(公式推导+numpy实现)
Dokcer running Nacos container automatic exit problem
RK3399平台开发系列讲解(ALSA子系统)4.37、ALSA驱动框架
超实用转型攻略:《2022央国企云原生落地实用指南》正式发布
测试员职场最大的危机不是30岁,而是中年被裁
随机推荐
RK3399平台开发系列讲解(ALSA子系统)4.37、ALSA驱动框架
GBase8s数据库SET CONSTRAINTS 语句
如何消除 MySQL表中的字段特别设置的字符集和排序规则?
Gbase8s database comparison performed by database objects
Rk3399 platform development series explanation (alsa subsystem) 4.37, alsa driven framework
Gbase8s database makes the current connection a dormant connection
QT笔记——Qt动态属性 之 unpolish() 和 polish()
Unity textmeshpro namespace reference and component acquisition
会议OA项目之会议发布功能
VCs and Verdi learning records
GBase8s数据库SET AUTOFREE 语句
Calculate deposit interest
Gbase8s database specifies the comparison order with set collation
力扣练习——29 按要求补齐数组
QT笔记——自定义数据类型
Gbase8s database minus operator
web3分享
43. 字符串相乘
Pytoch implements word2vec
24、 TF coordinate transformation (IV): multi coordinate transformation and coordinate system relationship view