none
ADO WithEvents RRS feed

  • 问题

  • 微软好:最近又遇问题请教, 代码如下(VBA)
    Private WithEvents cn As ADODB.Connection
    Private WithEvents rs As ADODB.Recodset

    Set cn = New ADODB.Connection
        With cn
            .Provider = "Microsoft.ACE.OLEDB.12.0"
            .ConnectionString = cnStr
            .CommandTimeout = 2
            .ConnectionTimeout = 1
            .CursorLocation = adUseClient
            .Mode = adModeReadWrite
        End With
        cn.Open    ''''''' , , , adAsyncConnect异步连接没有成功,只触发cn_WillConnect事件,同步成功触发                         ''''''''''''cn_WillConnect,cn_ConnectComplete,cn_ExecuteComplete

        Set rs = New ADODB.Recordset
            With rs
                Set .ActiveConnection = cn
                .CursorLocation = adUseClient
                .Properties("Initial Fetch Size") = 1
                .Properties("Background Fetch Size") = 1
                ''''''''.Open SQL, cn, adOpenForwardOnly, adLockReadOnly, adCmdText + adAsyncFetch''''''慢
            End With
            Set rs = cn.Execute(SQL, , adCmdText + adAsyncFetch) '[快ok,rs异步成功,但怀疑根本没有异步,理由是没有触发'''''''''''''''rs_FetchComplete,rs_FetchProgress这二个事件,望请教!


    ZY
    2009年5月18日 13:53

答案