各位大虾好!
我用ADODC控件查询,怎么报错呢?写法如下
adodc1.recordset.find "字段1='"& aa &"' and 字段2='"& aa &"'"
这样写有错吗?
如adodc1.recordset.find "字段1='"& aa &"'" 写可以查询,为什么联两个字段以上用find不能查呢?我错在哪??
我用ADODC控件查询,怎么报错呢?写法如下
adodc1.recordset.find "字段1='"& aa &"' and 字段2='"& aa &"'"
这样写有错吗?
如adodc1.recordset.find "字段1='"& aa &"'" 写可以查询,为什么联两个字段以上用find不能查呢?我错在哪??
strsearch = Trim(Text1.Text)
strtable = "目录"
strFilter = " " & stroption & " like " & " '%" & strsearch & "%' "
strgoods = "*" '"内容"strSQL = "select " & strgoods & " from " & strtable & " where " & stroption & " like '%" & strsearch & "%'"
1 表中设置一个 ID 字段(唯一值,例如自动增加)。
2 另外用一个记录集查找你的目标记录的 ID,然后 Find 这个 ID。
dim rs as new adodb.recordset
Set rs = adodc1.RecordSet.ActiveConnection.Execute("Select ID From tablename Where 字段1='"& aa &"' and 字段2='"& aa &"'")
adodc1.recordset.find "ID = "& rs!ID
rs.Close
Set rs = Nothing