尝试在 Web 服务器上的访问数据库中创建链接表时出错 - 错误是ADOX.Catalog
不确定我是否需要继承 ADOX 或如何继承?
错误是:
编译器错误消息:BC30002:未定义类型“ADODB.Catalog”。
Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim A As String = "e:\web\Training.mdb"
Dim B As String = "e:\web\LeaveDB.mdb"
Dim C As String = "UsersDataTbl"
Dim D As String = "NewUsers"
CreateLinkedAccessTable(A,B,C,D)
End Sub
Sub CreateLinkedAccessTable(strDBLinkFrom As String, strDBLinkTo As String, strLinkTbl As String, strLinkTblAs As String)
Dim catDB As ADOX.Catalog
Dim tblLink As ADOX.Table
Set catDB = New ADOX.Catalog
' Open a Catalog on the database in which to create the link.
catDB.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strDBLinkFrom
Set tblLink = New ADOX.Table
With tblLink
' Name the new Table and set its ParentCatalog property to the
' open Catalog to allow access to the Properties collection.
.Name = strLinkTblAs
Set .ParentCatalog = catDB
' Set the properties to create the link.
.Properties("Jet OLEDB:Create Link") = True
.Properties("Jet OLEDB:Link Datasource") = strDBLinkTo
.Properties("Jet OLEDB:Remote Table Name") = strLinkTbl
End With
' Append the table to the Tables collection.
catDB.Tables.Append tblLink
Set catDB = Nothing
End Sub