PRB: ????? ????? ??????? ??? ??????? ADOX ???????? ????? ?? ???? Access

?????? ????????? ?????? ?????????
???? ???????: 299484 - ??? ???????? ???? ????? ????? ??? ???????.
??? ????? ??? ???????. ????? "??? ??" ??? ??? ??????? ??? ????.
????? ???? | ?? ????

?? ??? ??????

???????

??? ??????? ?????? ADOX ???????? ? ???? Microsoft OLE DB ?? Jet ???????? ????? ???? Microsoft Access ??? ??? ??????? ???????.

?????

????? OLE DB ?????? 4.0 ?? Jet ????? ?? ????? ????? ????? ?? ????? ???? ?????? ???????.

????

??????? ?????? ??? ??? ??????? ?????? ?????? ????? ODBC ?? Microsoft Access ????????? ?? ???? OLE DB ?? ODBC. ?? ???? ?????? OLE DB ?????, ??? ???? OLE DB ?? SQL Server ??? ???????.

??? ??? ??? ???? ??????? ???? OLE DB ?? Jet ?????? ??????? OpenSchema ?????? ADODB ????? ?? ??? ??????? ??????? ?? ??? ORDINAL_POSITION.

??????? ????

????? ????? ????? ??????

  1. ????? ????? EXE ????? ???? ?? Visual Basic. ??? ????? Form1 ???? ???????.
  2. ?? ??????? ??????? ???? "?????" ?? ???? ??? 2.1 ?????? ?????? ActiveX Microsoft ? Microsoft ADO Ext. 2.1 ?? DDL ???????.
  3. ????? ????? ???? CommandButton ??????? ??? Form1.
  4. ?? ???? ???????? ???????? ??????? ??? ???? Declarations Form1:
    Option Explicit
    
    Dim cnn As ADODB.Connection
    Dim cat As ADOX.Catalog
    Dim tbl As ADOX.Table
    Dim col As ADOX.Column
    
    
    Private Sub Command1_Click()
       Set cnn = New ADODB.Connection
       With cnn
          .Provider = "Microsoft.Jet.OLEDB.4.0;"
          .Open "Data Source=D:\Nwind.mdb;"
       End With
       Set cat = New ADOX.Catalog
       cat.ActiveConnection = cnn
       Set tbl = cat.Tables("Products")
       Debug.Print "Results using the OLEDB Provider and ADOX"
       For Each col In tbl.Columns
          Debug.Print col.Name
       Next
    End Sub
    
    Private Sub Command2_Click()
       Set cnn = New ADODB.Connection
       With cnn
          .Provider = "MSDASQL.1;"
          .Open "Driver={Microsoft Access Driver (*.mdb)};" & _
           "DBQ=D:\Nwind.mdb;"
       End With
       Set cat = New ADOX.Catalog
       cat.ActiveConnection = cnn
       Set tbl = cat.Tables("Products")
       Debug.Print "Results using the ODBC Driver and ADOX"
       For Each col In tbl.Columns
          Debug.Print col.Name
       Next
    End Sub
    
    
    Private Sub Command3_Click()
       Dim rsSchema As ADODB.Recordset
       Dim fld As ADODB.Field
       Dim rCriteria As Variant
    
       Set cnn = New ADODB.Connection
       With cnn
          .CursorLocation = adUseClient
          .Provider = "Microsoft.Jet.OLEDB.4.0;"
          .Open "Data Source=D:\Nwind.mdb;"
       
       End With
    
       Set rsSchema = cnn.OpenSchema(adSchemaColumns, _
            Array(Empty, Empty, "Products"))
       rsSchema.Sort = "ORDINAL_POSITION"
       Debug.Print "Results using the OpenSchema method"
       While Not rsSchema.EOF
          Debug.Print rsSchema!COLUMN_NAME
          rsSchema.MoveNext
       Wend
    End Sub
    					
  5. ????? ?????? cnn.Open ??????? ??? ??? ????? ?????? Microsoft Access ?????.
  6. ????? ??????? ?? ???? ??? Command1. ???? ?? ????? ?????? ??? ??? ??????? ??? ??????? ???? OLE DB.
  7. ???? ??? Command2. ???? ???? ????? ?????? ?? ???? ?????? ?????? ??? ??? ??????? ?????? ????? ODBC.
  8. ???? ??? Command3. ???? ???? ????? ?????? ?? ???? ?????? ?????? ??? ??? ??????? ???? OLE DB ?? ??????? OpenSchema.

?????

????? ?? ?????????? ???? ???????? MSDN ??????:
????? OpenSchema
http://msdn.microsoft.com/en-us/library/ms676705.aspx

???? ?????? ADOX
http://msdn.microsoft.com/en-us/library/ms677529.aspx

???????

???? ???????: 299484 - ????? ??? ??????: 28/???? ??????/1435 - ??????: 3.2
????? ???
  • Microsoft Data Access Components 2.0
  • Microsoft Data Access Components 2.1
  • Microsoft Data Access Components 2.1 Service Pack 2
  • Microsoft Data Access Components 2.1 Service Pack 1
  • Microsoft Data Access Components 2.1 Service Pack 2
  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.5 Service Pack 1
  • Microsoft Data Access Components 2.6
????? ??????: 
kbnosurvey kbarchive kbmt kbjet kbprb KB299484 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????299484

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com