????? ??? ??????? Microsoft Access ??????? ??????? ADO

?????? ????????? ?????? ?????????
???? ???????: 281998 - ??? ???????? ???? ????? ????? ??? ???????.
??????: ????? ????? ?????? ??????? ??????? ???????? ? ?????? ?????? ??????????.

????? ??? ?????? ??? ????? ?????? Microsoft Access (.mdb) ????? Microsoft Access (.adp).

????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ?? ????? ?????? ????? ??????? ???? ????? ??? ???? Recordset ?????? ?????? ActiveX (ADO).

??????? ????

??? ????? Microsoft Access ??? ?????? ????? ??? ???? ????? ??????? ?????? ??????? ??????? ??? ???? ???? ?????? ?????? ??? ???????? (DAO) ?? ?????? ????? ADO.

?? ????? ??????? Recordset ?? Microsoft Access 2000 ? ???? ???? ??????? ??? ?????? DAO ?? ?????? ????? ADO. ??? ???? ???? ??????? ?? Access 2000 updateability ??? ??? ?? ??? ????? ADO ???????? ????? MSDataShape ? SQL Server OLEDB. ?????? ??? ??????? ?????? ??? ??? ???? ?? Access 2000 ???? ??? ??? ??????? ????? ?????? ?? "????? ??????? ?? Microsoft:
227053ACC2000: ?? ??????? ???? ????? ??????? ??????? ADO ??????? ???
?? Microsoft Access 2002 ?? ??????? ??????? ????? ????? ????? ??????? ?????? ??? ?????? ????? ADO ?????? ?????? OLEDB ????????. ??? ?? ??? ????? ??? ??????? ?????? ??????? ????? ????? ??????? ??? ???? ??? ?????? ????? ADO. ????? ??? ??????? ??????:
  1. ??? ?? ???? ??????? ADO ?????? ???????.
  2. ??? ?? ????? ?????? ??????? ??? ??? ???? ?? ???? ???? ???? ????????, ??? ??????? ??????? ??????.
????? ??????? ???? updateability ??? ????? ??????. ???? ??? ??????? ?? ??????? ?????? ??? ??????? ????? Microsoft SQL Server ? Jet ODBC ? Oracle OLEDB.

??????? ???? Microsoft SQL

???? ????? ??????? ??????? ???? updateability ??? ??? ????? ??? ?????? ????? ADO ?????? Microsoft SQL Server ????????:
  • ???? ?? ?????? ????? ????? ADO ???? OLEDB Microsoft Access 10.0 ???? ?????? ????? ??.
  • ??? ?? ?????? ????? ????? ADO Microsoft SQL ???? OLEDB ?????? ??? ???? ???????? ????? ??.
??????:???? OLEDB 10.0 Access Microsoft ?? ???? ???? OLEDB ???? ?? ??????? ???? ??? ????????? ?? Microsoft Access. ?? ??? ????? ?? ??????? ???? ??? Microsoft Access ? ??? ????? ?? ????????? ??????.

??? ????? ??????? ??????? ADO ???? Microsoft Access ???? ???? ??? ???? ???? ????????? ????? ADO ?????? ?????? ???????. ???? ?????? ????????? ???????? ADO ????? ADO ?????? Microsoft Access ????? ?????? SQL Server ???????? ?????? ?? ??? ????? (ADP) Access; ?? ????? ????? ADO ????? ??????? ??????? ?????? ?????? ???? SQL ??????.

?????? ????? ADO ????????? ?????? Microsoft Access

??? ??? ?????? ??? ????? Access (.adp) ???? ?????? ?????? Microsoft SQL Server, ??? ?????? ???? ADO ??????? ????? ADO ?????? Microsoft Access. ????? ??? ??????? ?????? ??????? CurrentProject.AccessConnection.

???? ?????? ?????? ????? ??? ????? ??? ?????? ????? ADO ????? ??? ?????? SQL Server ???? ????? ????? ADO ?? Microsoft Access.
  1. ???? ??????? ????? NorthwindCS.adp.
  2. ???? ????? ??????? ?? ????? ????? "?????".
  3. ?? ?????? ????? ????? ???? ????? ??????? ??? ????? ????? ???????.
  4. ????? ????? "???_?????" ??????? ??? ????? ????? ??????:
    Private Sub Form_Open(Cancel As Integer)
       Dim cn As ADODB.Connection
       Dim rs As ADODB.Recordset
             
       'Use the ADO connection that Access uses
       Set cn = CurrentProject.AccessConnection
    
       'Create an instance of the ADO Recordset class, and
       'set its properties
       Set rs = New ADODB.Recordset
       With rs
          Set .ActiveConnection = cn
          .Source = "SELECT * FROM Customers"
          .LockType = adLockOptimistic
          .CursorType = adOpenKeyset
          .Open 
       End With
       
       'Set the form's Recordset property to the ADO recordset
       Set Me.Recordset = rs
    
       Set rs = Nothing
       Set cn = Nothing
    End Sub
    					
  5. ??? ?? ?? ?????? ???????.
  6. ???? ????? ??????? ?? ????? ????? "?????".
  7. ????? ?? ????? ?? ??? ??? ?? ???????.
???? ?? ??????? ?????? ??? ?????? ????? ??????? ????? ??? ?????? SQL Server.

??? ????? ADO ???

??? ???? ??? ?? ????? ??? ??? ?????? ?? ADO ?????? ??????? ?? SQL Server. ??? ???? ??????? ???? ?????? ??? ??????? ??? ??? ???? ????????? ???????? ?? ????? ?????? Access (.mdb) ?? ??? ????? Access (.adp) ???? ??? ?????? ?????? ?????? ???? SQL ?????? ?? ??????? ????? ??. ???? ??? ??? ??????? ??? ??????? ???? Microsoft ????? ????? ADO ???? ??? ?????? ??? ??? ??????. ??? ???? ??????? ?? ???? ?? ????? ????? ADO ?? ????? ????? ????? ???????.

???? ?????? ?????? ????? ??? ?????? ?? ADO ??????? ?????? ?????? Microsoft SQL Server ? ??? ??? ?????:
  1. ???? ????? ????? ???????? Northwind.mdb.
  2. ???? ????? ??????? ?? ????? ????? "?????".
  3. ?? ?????? ????? ????? ???? ????? ??????? ??? ????? ????? ???????.
  4. Set the OnOpen property of the form to the following event procedure:
    Private Sub Form_Open(Cancel As Integer)
       Dim cn As ADODB.Connection
       Dim rs As ADODB.Recordset
             
       'Create a new ADO Connection object
       Set cn = New ADODB.Connection
    
       'Use the Access 10 and SQL Server OLEDB providers to
       'open the Connection
       'You will need to replace MySQLServer with the name
       'of a valid SQL Server
       With cn
          .Provider = "Microsoft.Access.OLEDB.10.0"
          .Properties("Data Provider").Value = "SQLOLEDB"
          .Properties("Data Source").Value = "MySQLServer"
          .Properties("User ID").Value = "sa"
          .Properties("Password").Value = ""
          .Properties("Initial Catalog").Value = "NorthwindCS"
          .Open
       End With
    
       'Create an instance of the ADO Recordset class, and
       'set its properties
       Set rs = New ADODB.Recordset
       With rs
          Set .ActiveConnection = cn
          .Source = "SELECT * FROM Customers"
          .LockType = adLockOptimistic
          .CursorType = adOpenKeyset
          .Open 
       End With
       
       'Set the form's Recordset property to the ADO recordset
       Set Me.Recordset = rs
       Set rs = Nothing
       Set cn = Nothing
    End Sub
    					
  5. ?? ?????? ????????? ???????? ??????? ??? ????? ????? ????? ???????:
    Private Sub Form_Unload(Cancel As Integer)
       'Close the ADO connection we opened
       Dim cn As ADODB.Connection
       Set cn = Me.Recordset.ActiveConnection
       cn.Close
       Set cn = Nothing
    End Sub
    					
  6. ??? ??????? ?? ?? ?????? ????.
  7. ???? ????? ??????? ?? ????? ????? "?????".
  8. ????? ?? ????? ?? ??? ??? ?? ???????.
???? ?? ??????? ?????? ??? ?????? ????? ??????? ????? ??? ?????? SQL Server.

??????? Microsoft Jet

??? ????? ?? ?? ??? ?????? ??? ????? ??? ?????? ????? ADO ?????? ?????? ?? ????? ?????? Jet ???? Microsoft ???????? DAO ????? ?? ???. DAO ???? ??????? Jet ?? ????? ????? ???? ?? ADO ??? ????????? ?? ????? ?????? Jet.

??? ????? ??? ADO ?????? ??????? ???????? ?????? Microsoft Jet ???? ????? ?????:
  • ??? ??? ??????? ActiveConnection ?????? ??????? ?????? ???? ???? Microsoft Access 10.0 OLEDB ???????? ??? "Microsoft Jet 4.0 OLEDB ????????" ???? ? ?????? ??????? ??? ?? ???? ??? ???? ?? ???? ??????.

    - ?? -
  • ??? ??????? ????? ActiveConnection ?????? ??????? ??? ?????? OLEDB ????? ?? Microsoft Jet 4.0 ???? ? ?????? ??????? ??? ?? ???? ???? ?? ???? ??????.
?????? ??? "Microsoft SQL Server" ?? ??? ??????? ???? ???? ??? ???? ????? ADO ??? ??? ????????? ?? ??? ?????? ??????? ??? ??????? ????? ?????? Jet. ???? ?????? ????????? ???????? ADO ????? ADO ?????? Microsoft Access ???? Jet ????? ?????? (. mdb) ??????? ?????? ?? ????? ????? ????? ADO ???? Jet ?????? ??????? ??? ????? ????????.

?????? ????? ADO ????????? ?????? Microsoft Access

??? ??? ??? ????? ????????? ???????? ?? ??? ????? ???????? Microsoft Access (.mdb) ???? ????? ??? ???????? ???? ??????? ?????? ??????? ????? ?? ???? ???? ADO ??????? ????? ADO ?????? Microsoft Access. ????? ??? ??????? ?????? ??????? CurrentProject.AccessConnection. ???? ?????? ?????? ????? ??? ????? ??? ?????? ????? ADO ?? ????? ?????? Jet ??????? ????? ADO ???? ?????? Microsoft Access ??????:
  1. ???? ????? ????? ???????? Northwind.mdb.
  2. ???? ????? ??????? ?? ????? ????? "?????".
  3. ?? ?????? ????? ????? ???? ????? ??????? ??? ????? ????? ???????.
  4. ????? ????? "???_?????" ??????? ??? ????? ????? ??????:
    Private Sub Form_Open(Cancel As Integer)
       Dim cn As ADODB.Connection
       Dim rs As ADODB.Recordset
                    
       Set cn = CurrentProject.AccessConnection
    
       'Create an instance of the ADO Recordset class, and
       'set its properties
       Set rs = New ADODB.Recordset
       With rs
          Set .ActiveConnection = cn
          .Source = "SELECT * FROM Customers"
          .LockType = adLockOptimistic
          .CursorType = adOpenKeyset
          .CursorLocation = adUseServer
          .Open 
       End With
       
       'Set the form's Recordset property to the ADO recordset
       Set Me.Recordset = rs
       Set rs = Nothing
       Set cn = Nothing
    End Sub
    					
  5. ??? ??????? ?? ?? ?????? ????.
  6. ???? ????? ??????? ?? ????? ????? "?????".
  7. ????? ?? ????? ?? ??? ??? ?? ???????.
???? ?? ??????? ?????? ??? ?????? ????? ??????? ?????? ?????? Jet.

??? ????? ADO ???

??? ???? ??? ?? ????? ??? ??? ???????? ?????? ?? ADO ????? ????? ?????? Jet. ??? ???? ??????? ???? ??????? ??? ??????? ?? ???? ????? ????????? ???????? ?? ????? ?????? ?????? ?? ????? ???????? ???? ????? ??? ???????? ???? ????? ??? ??????. ???? ??? ??? ??????? ??? ??????? ???? Microsoft ????? ????? ADO ???? ??? ?????? ??? ??? ??????. ??? ???? ??????? ?? ????? ??? ????? ADO ??? ????? ?? ????? ????? ????? ???????.

???? ?????? ?????? ????? ??? ??????? ADO ??? ????? ?????? Microsoft Jet ??? ?????:
  1. ????? ????? ?????? ????? ?????.
  2. ??????? ????? ??????? ?? ??????? ????? ???????? Northwind.mdb.
  3. ???? ????? ??????? ?? ????? ????? "?????".
  4. ?? ?????? ????? ????? ???? ????? ??????? ??? ????? ????? ???????.
  5. ????? ????? "???_?????" ??????? ??? ????? ????? ??????:
    Private Sub Form_Open(Cancel As Integer)
       Dim cn As ADODB.Connection
       Dim rs As ADODB.Recordset
             
       'Create a new ADO Connection object
       Set cn = New ADODB.Connection
    
       With cn
          .Provider = "Microsoft.Access.OLEDB.10.0"
          .Properties("Data Provider").Value = "Microsoft.Jet.OLEDB.4.0"
          .Properties("Data Source").Value = _
              "C:\Program Files\Microsoft Office\Office10" & _
              "\Samples\Northwind.mdb"
          .Open
       End With
    
       'Create an instance of the ADO Recordset class, and
       'set its properties
       Set rs = New ADODB.Recordset
       With rs
          Set .ActiveConnection = cn
          .Source = "SELECT * FROM Customers"
          .LockType = adLockOptimistic
          .CursorType = adOpenKeyset
          .Open 
       End With
       
       'Set the form's Recordset property to the ADO recordset
       Set Me.Recordset = rs
       Set rs = Nothing
       Set cn = Nothing
    End Sub
    					
  6. ?? ?????? ????????? ???????? ??????? ??? ????? ????? ????? ???????:
    Private Sub Form_Unload(Cancel As Integer)
       'Close the ADO connection we opened
       Dim cn As ADODB.Connection
       Set cn = Me.Recordset.ActiveConnection
       cn.Close
       Set cn = Nothing
    End Sub
    					
  7. ??? ??????? ?? ?? ?????? ????.
  8. ???? ????? ??????? ?? ????? ????? "?????".
  9. ????? ?? ????? ?? ??? ??? ?? ???????.
???? ?? ??????? ?????? ??? ?????? ????? ??????? ?????? ?????? Jet.

??????? ODBC

??? ??? ????? ??? ?????? ????? ADO ?????? ?????? ?? ????? ?????? ODBC ???? ??????? ??????? ?????:
  • ??? ?? ?????? ????? ADO ????????? ?? ??? ?????? ??????? ???? OLEDB Microsoft ?? ODBC.
  • ??? ?? ???? ????? ADO ???? ?? ???? ??????.
???? ?????? ?????? ????? ??? ADO ??????? ?????? ?????? ODBC "?" ??? ??? ?????.

??????: ????? ??? ??????? ?? ????? ?????? ODBC ????? ??? ???? ???? ??????? ????? ???? ?? ???? ???? ??????? ?? ????? ????? ???????? Northwind.mdb. ????? ????? ????? ODBC DSN ?????? MyDSN ?????? ?????? ????? ODBC ???? ????? ??? ??????? ?????? ?????? ??????? ???????.
  1. ???? ????? ????? ???????? Northwind.mdb.
  2. ???? ????? ??????? ?? ????? ????? "?????".
  3. ?? ?????? ????? ????? ???? ????? ??????? ??? ????? ????? ???????.
  4. ????? ????? "???_?????" ??????? ??? ????? ????? ??????:
    Private Sub Form_Open(Cancel As Integer)
       Dim cn As ADODB.Connection
       Dim rs As ADODB.Recordset
       Dim strConnection As String
    
       strConnection = "ODBC;DSN=MyDSN;UID=sa;PWD=;DATABASE=Northwind"
       'Create a new ADO Connection object
       Set cn = New ADODB.Connection
    
       With cn
          .Provider = "MSDASQL"
          .Properties("Data Source").Value = strConnection
          .Open
       End With
    
       'Create an instance of the ADO Recordset class, and
       'set its properties
       Set rs = New ADODB.Recordset
       With rs
          Set .ActiveConnection = cn
          .Source = "SELECT * FROM Customers"
          .LockType = adLockOptimistic
          .CursorType = adOpenKeyset
          .CursorLocation = adUseClient
          .Open 
       End With
       
       'Set the form's Recordset property to the ADO recordset
       Set Me.Recordset = rs
       Set rs = Nothing
       Set cn = Nothing
    End Sub
    					
  5. ?? ?????? ????????? ???????? ??????? ??? ????? ????? ????? ???????:
    Private Sub Form_Unload(Cancel As Integer)
       'Close the ADO connection we opened
       Dim cn As ADODB.Connection
       Set cn = Me.Recordset.ActiveConnection
       cn.Close
       Set cn = Nothing
    End Sub
    					
  6. ??? ??????? ?? ?? ?????? ????.
  7. ???? ????? ??????? ?? ????? ????? "?????".
  8. ????? ?? ????? ?? ??? ??? ?? ???????.
???? ?? ??????? ?????? ??? ?????? ????? ??????? ????? ??? ?????? ODBC.

??????? Oracle

??? ??? ????? ??? ?????? ????? ADO ?????? ?????? ?? ????? ?????? Oracle ???? ??????? ??????? ?????:
  • ??? ?? ?????? ????? ADO ????????? ?? ??? ?????? ??????? ???? OLEDB Microsoft ?? Oracle.
  • ??? ?? ???? ?????? ??????? ADO ???? ?? ???? ??????.
???? ?????? ?????? ????? ??? ADO ??????? ?????? ?????? Oracle ? ??? ??? ?????.

??????: ????? ??? ??????? ?? ????? ?????? Oracle ????? ??? ???? ???? ??????? ????? ???? ?? ???? ???? ??????? ?? ????? ????? ???????? Northwind.mdb.
  1. ???? ????? ????? ???????? Northwind.mdb.
  2. ???? ????? ??????? ?? ????? ????? "?????".
  3. ?? ?????? ????? ????? ???? ????? ??????? ??? ????? ????? ???????.
  4. ????? ????? "???_?????" ??????? ??? ????? ????? ??????:
    Private Sub Form_Open(Cancel As Integer)
       Dim cn As ADODB.Connection
       Dim rs As ADODB.Recordset
             
       'Create a new ADO Connection object
       Set cn = New ADODB.Connection
    
       With cn
          .Provider = "MSDAORA"
          .Properties("Data Source").Value = "MyOracleServer"
          .Properties("User ID").Value = "username"
          .Properties("Password").Value = "password"          
          .Open
       End With
    
       'Create an instance of the ADO Recordset class, and
       'set its properties
       Set rs = New ADODB.Recordset
       With rs
          Set .ActiveConnection = cn
          .Source = "SELECT * FROM Customers"
          .LockType = adLockOptimistic
          .CursorType = adOpenKeyset
          .CursorLocation = adUseClient
    
          .Open 
       End With
      
       'Set the form's Recordset property to the ADO recordset
       Set Me.Recordset = rs
       Set rs = Nothing
       Set cn = Nothing
    End Sub
    					
  5. ?? ?????? ????????? ???????? ??????? ??? ????? ????? ????? ???????:
    Private Sub Form_Unload(Cancel As Integer)
       'Close the ADO connection we opened
       Dim cn As ADODB.Connection
       Set cn = Me.Recordset.ActiveConnection
       cn.Close
       Set cn = Nothing
    End Sub
    					
  6. ??? ??????? ?? ?? ?????? ????.
  7. ???? ????? ??????? ?? ????? ????? "?????".
  8. ????? ?? ????? ?? ??? ??? ?? ???????.
???? ?? ??????? ?????? ??? ?????? ????? ??????? ????? ??? ?????? Oracle.

?????

?????? ??? ??????? ??????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
281784????? ??? ??????? ???????? AccessConnection
?????? ?????? ?????? ???? ??? ???????? ?? ??? ??????? ???? ????? ?????? ?????? ?? Microsoft. ?? ???? Microsoft ?? ???? ? ?????? ?? ??????? ????? ???? ?? ???? ?????? "?? ??? ????????.

???????

???? ???????: 281998 - ????? ??? ??????: 19/???? ??????/1425 - ??????: 4.3
????? ???
  • Microsoft Office Access 2003
  • Microsoft Access 2002 Standard Edition
????? ??????: 
kbmt kbado kbdatabinding kbdatabase kbdesign kbprogramming kbhowto KB281998 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????281998

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

 

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