access筛选器无法与adodb.recordset连接错误(无法初始化数据提供程序)

sqyvllje  于 2021-06-18  发布在  Mysql
关注(0)|答案(0)|浏览(189)

我们已经将access数据库的一部分迁移到mysql中,这个片段只是从包含表单名称和sql语句的表中检索sql语句,然后将其设置为表单记录集
我现在遇到的问题是,虽然速度有了很大的提高,但是访问前端现在并没有像预期的那样完全正常工作,刷新和按文本过滤访问函数不起作用,只是抛出错误(数据提供程序无法初始化)。
我相信这与我们将recordsource设置为窗体有关,是否存在性能没有大幅下降的情况?
如果我只是将mysql中的一个视图链接到access中,并将forms recordsource设置为该视图,那么加载和过滤所需的时间就要长得多
这里的照片http://puu.sh/bxw55/fe8b01d8d0.jpg 在尝试使用访问筛选器时显示错误发生的时间
函数如下:

Private Sub Command91_Click() 'Clear filters'
On Error GoTo ErrHandler
Dim oConn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim ConnStr As String
Dim strOrderBy As String

'Creating new connection, and then using ConnectString function to connect to mysql Database'
Set oConn = New ADODB.Connection
oConn.Open ConnectString

'Clears filter fields to null'
fltrDocBaseID.Value = Null
fltrDocBaseClientDocNumber.Value = Null
fltrDisciplinesID.Value = Null
fltrDocTypeID.Value = Null
fltrDocSubTypesID.Value = Null
fltrProjectID.Value = Null
FilterOn = False
fltrDocBaseTitle1.Value = Null
fltrDocBaseTitle2.Value = Null
fltrDocBaseTitle3.Value = Null
fltrDocBaseTitle4.Value = Null

'Retrieves SQL code from refreshDS(fname As String) located in Module- SQLDatasources'
strSQL = refreshRS(Me.Name)
'Creates new recordset'

Set rs = New ADODB.Recordset
'Connects to mysql database, runs strSQL and then sets page recordset'
'to the current strSQL'
With rs
    Set .ActiveConnection = oConn
    .Source = strSQL
    .LockType = adLockOptimistic
    .CursorType = adOpenKeyset
    .CursorLocation = adUseClient
    .Open
End With

Set Me.Recordset = rs
'Closes recordset and connections, This is a good practice for traffic efficiency'
rs.Close
oConn.Close
Set rs = Nothing
Set oConn = Nothing

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题