答案 0 :(得分:0)
并非所有Recordset都支持索引和搜索。你确定用正确的参数打开了Recordset吗?
从Seek Method and Index Property Example (VB)开始关注此示例。确保使用相同的参数打开Recordset。
rstEmployees.Open strSQLEmployees, strCnxn, adOpenKeyset, adLockReadOnly, adCmdTableDirect
然后使用此代码段查看是否支持索引和搜寻:
' Does this provider support Seek and Index?
If rs1.Supports(adIndex) And rs1.Supports(adSeek) Then
MsgBox "Success: Seek and Index are Supported"
Else
MsgBox "Failure: Seek and Index are not Supported"
End If