2013-10-26 2 views
2

웹 서버의 액세스 DB에 연결된 테이블을 만들 때 오류가 발생합니다. ADOX.Catalog에 ADOX를 상속 할 필요가 있는지 확실하지 않습니다.웹 서버의 MS-Access DB에 연결된 테이블을 만듭니다.

오류는 다음과 같습니다

컴파일러 오류 메시지 : BC30002 : 형식 'ADODB.Catalog'가 정의되어 있지 않습니다. 당신이 당신의 ASP.NET 프로젝트를 열고 다음 COM 참조 추가해야 ADOX를 사용하려면

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 
+0

내가 사용하고 코드를 맛볼 수있는 링크입니다 : http://msdn.microsoft.com/en-us/library/office/aa164914(v=office.10).aspx – BarclayVision

+0

은 참조 또는 가져 오기가 누락 된 것 같습니다. http://allenbrowne.com/func-adox.html (맨 위로 올라가면 ref에 대해 말합니다) 내 시스템에 COM 객체가있는 것처럼 보입니다 – Plutonix

+0

그래, 그걸 보았습니다. 타사 서버에서이 작업을 수행 할 때 포함시킬 DLL을 찾지 못했습니다. – BarclayVision

답변

1

: 여기

Microsoft ADO Ext. 2.8 for DDL and Security

+0

ADOX.dll없이 다른 액세스 DB 테이블에 연결할 수 있습니까? 예 : Access 데이터 테이블 스키마를 얻으려면 ADO.NET을 통해 OleDbConnection.GetOleDbSchemaTable 메서드를 사용하십시오. 연결된 테이블 데이터를 ADOX가 아닌 OLEDB로 업데이트 할 수 있습니까? – BarclayVision

+0

@BarclayVision 필요하지 않을 수도 있습니다. 나는 당신의 다른 질문에 대한 답변을 게시 할 것입니다. –