SQL语句
Private Sub Command1_Click()
Adodc2.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\study\workplan.mdb;Persist Security Info=False"
Adodc2.CommandType = adCmdText
Adodc2.CursorLocation = adUseClient
Adodc2.LockType = adLockPessimistic
Adodc2.RecordSource = "select * from workinfo"
Adodc2.Refresh
If Text1.Text = "" Then
MsgBox ("不能为空")
Else
Adodc2.RecordSource = "select * from workinfo where name like '% "& text1.text &"%'"
Set DataGrid2.DataSource = Adodc2
Adodc2.Refresh
DataGrid2.Refresh
End If
End Sub
我总是查不数据,如果NAME指定一个值就可以查询到。高手帮忙看一下。谢谢了!
[解决办法]
ACCESS中不是用%,是用*