vb连接excel实现对B列数据模糊查询,如何写???
本帖最后由 chinatyq 于 2013-01-18 21:25:24 编辑 excel表(sheet1):
A B
455 社会主义
658 资本主义
522 共产主义
... ....
Dim xlConn As New ADODB.Connection
Dim xlRs As New ADODB.Recordset
Dim strConn As String
Dim xlCnt As Integer
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Book1.xls;Extended Properties='Excel 8.0;HDR=yes;IMEX=1'"
xlConn.Open strConn
xlRs.Open "select * from [sheet1$] where b=like ...???", xlConn, adOpenStatic, adLockReadOnly
like后面如何写
[解决办法]
xlRs.Open "select * from [sheet1$] where b=like '%主义%'"