以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]Connections  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=102852)

--  作者:okok0611
--  发布时间:2017/6/26 20:54:00
--  [求助]Connections
Dim dlg As New OpenFileDialog
dlg.Filter = "Access文件|*.mdb"
dlg.MultiSelect = True \'允许选择多个文件
If dlg.ShowDialog =DialogResult.OK Then    
    For Each fl As String In dlg.FileNames
        Dim pwd As String
        If InputPassWord(pwd,"提示","请输入密码:") Then
            If Connections.Contains("test") Then Connections.Delete("test")
            Connections.Add("test","Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & fl & ";Persist Security Info=True;Password=" & pwd )
            For Each tn As String In Connections("test").GetTableNames
                Dim mg As New Merger
                mg.SourcePath = fl
                mg.SourceTableName = tn
                mg.DataTableName = tn
                mg.Merge()
            Next
        End If
    Next
End If
为什么总是提示:创建外部连接“test"失败?

--  作者:有点蓝
--  发布时间:2017/6/26 21:37:00
--  
 Connections.Add("test","Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & fl & ";Persist Security Info=False;Jet OLEDB:Database Password=" & pwd )