这是我做的一段程序,在资料中了解到通过索引功能能极大的提高查询的效率,但我写完代码运行了以后,系统提示"当前提供程序不支持"索引"功能的界面",系统返回的rstEmployees.Supports(adIndex)的值为FALSE,不知为何,请高手指教!!,我把完整的源代码发上来,请大家帮我分析一下!!
Dim rstEmployees As ADODB.Recordset
    Dim Cnxn As ADODB.Connection
    Dim strCnxn As String
    Dim strSQLEmployees As String
    Dim strID As String    ' Open connection
    Set Cnxn = New ADODB.Connection
    strCnxn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=station;Data Source="
    Cnxn.Open strCnxn
     ' open recordset server-side for indexing
    Set rstEmployees = New ADODB.Recordset
    rstEmployees.CursorLocation = adUseClient
    strSQLEmployees = "tblselltick"
    rstEmployees.Open strSQLEmployees, strCnxn, adOpenKeyset, adLockReadOnly, adCmdTableDirect
    
    If rstEmployees.Supports(adIndex) And rstEmployees.Supports(adSeek) Then
       rstEmployees.Index = "stop_no"
       rstEmployees.Seek "=", "cdw"
       MsgBox 12
    End If    MsgBox rstEmployees.Supports(adIndex)

解决方案 »

  1.   

    试试:
    注释掉 rstEmployees.CursorLocation = adUseClient改一下 rstEmployees.Open strSQLEmployees, strCnxn, adOpenKeyset, adLockReadOnly, AdCmdTable
    Supports就是确定指定的Recordset对象是否支持特定类型的功能。返回false就说明你的rs不支持这样的功能,所以尝试修改你打开rs的相关参数。
    ado参考上有示例,你可以在网络上搜索查询一下