在vb6.0中在一条select语句时候能多次用到like吗? 多次模糊查询
PrivateSubCommand4_Click()Dimsql3AsStringDimsql4AsStringSetconn=NewADODB.Connectionco...
Private Sub Command4_Click()
Dim sql3 As String
Dim sql4 As String
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ucacess;Data Source=FDD3D52D4BEC45B"
conn.Open
Set RS = New ADODB.Recordset
RS.ActiveConnection = conn
sql3 = "select count(*) from test where Click like '%" & Combo6 & "%'"
RS.CursorLocation = adUseClient
RS.Open sql3, conn
Set DataGrid1.DataSource = RS
DataGrid1.Refresh
End Sub
我想在前台combo控件中选择的数据表现到这句sql语句中。以下的这句能实现吗?
sql3 = "select count(*) from test where Click like '%" & Combo6 & "%'" AND Click like '%" & Combo5 & "%'" AND Click like '%" & Combo4 & "%'" 如果不能实现我该怎么该?
谢谢帮助 展开
Dim sql3 As String
Dim sql4 As String
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ucacess;Data Source=FDD3D52D4BEC45B"
conn.Open
Set RS = New ADODB.Recordset
RS.ActiveConnection = conn
sql3 = "select count(*) from test where Click like '%" & Combo6 & "%'"
RS.CursorLocation = adUseClient
RS.Open sql3, conn
Set DataGrid1.DataSource = RS
DataGrid1.Refresh
End Sub
我想在前台combo控件中选择的数据表现到这句sql语句中。以下的这句能实现吗?
sql3 = "select count(*) from test where Click like '%" & Combo6 & "%'" AND Click like '%" & Combo5 & "%'" AND Click like '%" & Combo4 & "%'" 如果不能实现我该怎么该?
谢谢帮助 展开
2013-08-12
展开全部
还真没这样用过,但我 感觉如果能用
也应该用OR连接吧
也应该用OR连接吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-08-12
展开全部
可以这样使用但是你的sql就变成要满足三个条件了应该 三个条件是 或者的关系吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询