| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 390 人关注过本帖
标题:帮帮忙~~~~~~~~~~~~~~~~
取消只看楼主 加入收藏
longwindwind
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2005-11-7
收藏
 问题点数:0 回复次数:1 
帮帮忙~~~~~~~~~~~~~~~~

帮忙看一下,我想作一个查询复合多条条件的记录,我这样写总是查不出来,怎么改能改成查出复合多个条件的记录
Dim mysql As String
mysql = "select * from s where sno is not null"
If Check1.Value Then
mysql = mysql & " and sno='" & Text2.Text & "' "

If Check2.Value Then
mysql = mysql & " and sn='" & Text3.Text & "' "

If Check3.Value Then
mysql = mysql & " and sex='" & Text4.Text & "' "

If Check4.Value Then
mysql = mysql & " and age=" & Text5.Text & " "

If Check5.Value Then
mysql = mysql & " and dept='" & Text6.Text & "' "

If Check6.Value Then
mysql = mysql & " and nn='" & Text7.Text & "' "

End If
End If
End If
End If
End If
End If
Set i = New ADODB.Connection
Set j = New ADODB.Recordset
i.ConnectionString = "provider=sqloledb.1;data source=(local);user id=sa;pwd=247162545;initial catalog=sdb"
i.Open
j.Open mysql, i, adOpenDynamic, adLockOptimistic
Set MSHFlexGrid1.DataSource = j
Text8.Text = mysql

2005-11-08 13:55
longwindwind
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2005-11-7
收藏
得分:0 

哦,谢谢~~

2005-11-09 18:18
快速回复:帮帮忙~~~~~~~~~~~~~~~~
数据加载中...
 
   



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

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