VB数据库编程问题,继续在线等!

来源:百度知道 编辑:UC知道 时间:2024/05/13 14:58:13
Private Sub Command1_Click()
Text1 = Text2.Text
Text = "*" & Text1 & "*"
SQL = "select * from 主表 where 评标范围 like '" & Text & "' order by 序号"
Adodc1.RecordSource = SQL

Adodc1.Refresh

End Sub

想实现通配符查询,怎么办?

Text = "*" & Text1 & "*"
改为
Text = "%" & Text1 & "%"

LIKE '5[%]' 表5%
LIKE '5%' 表5 后跟 0 个或更多字符的字符串
LIKE '[_]n' 表_n
LIKE '_n' 表an, in, on (and so on)
LIKE '[a-cdf]' 表a, b, c, d, or f
LIKE '[-acdf]' 表-, a, c, d, or f
LIKE '[ [ ]' 表[
LIKE ']' 表]