请看下面代码,用like进行匹配查询时,如果指定精确值,正常,而指定像"一*"或"孙*"等值时会出错,
其中数据库名db5,表renshi,字段id(自动编号),number(数字),name(文本),
正常代码;
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=G:\db5.mdb;"
Set adoPrimaryRS = New Recordset
strcn = "SELECT * FROM renshi WHERE id Like '11';"
adoPrimaryRS.Open strcn, db, adOpenStatic, adLockOptimistic
MsgBox adoPrimaryRS.Fields("name")
出错代码;即无记录
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=G:\db5.mdb;"
Set adoPrimaryRS = New Recordset
strcn = "SELECT * FROM renshi WHERE id Like '一*';"
adoPrimaryRS.Open strcn, db, adOpenStatic, adLockOptimistic
MsgBox adoPrimaryRS.Fields("name")
是不是有些参数不正确,请各位高手指教,谢谢!