??? ????? Microsoft Access ??? ?????? ????? ??? ???? ????? ???????
?????? ??????? ??????? ??? ???? ???? ?????? ?????? ??? ???????? (DAO) ??
?????? ????? ADO.
?? ????? ???????
Recordset ?? Microsoft Access 2000 ? ???? ???? ??????? ??? ?????? DAO ??
?????? ????? ADO. ??? ???? ???? ??????? ?? Access 2000 updateability ??? ??? ?? ??? ????? ADO ???????? ????? MSDataShape ? SQL Server OLEDB. ?????? ??? ??????? ?????? ??? ??? ???? ?? Access 2000 ???? ??? ??? ??????? ????? ?????? ?? "????? ??????? ?? Microsoft:
227053
(http://support.microsoft.com/kb/227053/EN-US/
)
ACC2000: ?? ??????? ???? ????? ??????? ??????? ADO ??????? ???
?? Microsoft Access 2002 ?? ??????? ??????? ????? ????? ????? ??????? ?????? ??? ?????? ????? ADO ?????? ?????? OLEDB ????????. ??? ?? ??? ????? ??? ??????? ?????? ??????? ????? ????? ??????? ??? ???? ??? ?????? ????? ADO. ????? ??? ??????? ??????:
- ??? ?? ???? ??????? ADO ?????? ???????.
- ??? ?? ????? ?????? ??????? ??? ??? ???? ?? ???? ???? ???? ????????, ??? ??????? ??????? ??????.
????? ??????? ???? 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.
- ???? ??????? ????? NorthwindCS.adp.
- ???? ????? ??????? ?? ????? ????? "?????".
- ?? ?????? ????? ????? ???? ????? ??????? ??? ????? ????? ???????.
- ????? ????? "???_?????" ??????? ??? ????? ????? ??????:
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
- ??? ?? ?? ?????? ???????.
- ???? ????? ??????? ?? ????? ????? "?????".
- ????? ?? ????? ?? ??? ??? ?? ???????.
???? ?? ??????? ?????? ??? ?????? ????? ??????? ????? ??? ?????? SQL Server.
??? ????? ADO ???
??? ???? ??? ?? ????? ??? ??? ?????? ?? ADO ?????? ??????? ?? SQL Server. ??? ???? ??????? ???? ?????? ??? ??????? ??? ??? ???? ????????? ???????? ?? ????? ?????? Access (.mdb) ?? ??? ????? Access (.adp) ???? ??? ?????? ?????? ?????? ???? SQL ?????? ?? ??????? ????? ??. ???? ??? ??? ??????? ??? ??????? ???? Microsoft ????? ????? ADO ???? ??? ?????? ??? ??? ??????. ??? ???? ??????? ?? ???? ?? ????? ????? ADO ?? ????? ????? ????? ???????.
???? ?????? ?????? ????? ??? ?????? ?? ADO ??????? ?????? ?????? Microsoft SQL Server ? ??? ??? ?????:
- ???? ????? ????? ???????? Northwind.mdb.
- ???? ????? ??????? ?? ????? ????? "?????".
- ?? ?????? ????? ????? ???? ????? ??????? ??? ????? ????? ???????.
- 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
- ?? ?????? ????????? ???????? ??????? ??? ????? ????? ????? ???????:
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
- ??? ??????? ?? ?? ?????? ????.
- ???? ????? ??????? ?? ????? ????? "?????".
- ????? ?? ????? ?? ??? ??? ?? ???????.
???? ?? ??????? ?????? ??? ?????? ????? ??????? ????? ??? ?????? 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 ??????:
- ???? ????? ????? ???????? Northwind.mdb.
- ???? ????? ??????? ?? ????? ????? "?????".
- ?? ?????? ????? ????? ???? ????? ??????? ??? ????? ????? ???????.
- ????? ????? "???_?????" ??????? ??? ????? ????? ??????:
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
- ??? ??????? ?? ?? ?????? ????.
- ???? ????? ??????? ?? ????? ????? "?????".
- ????? ?? ????? ?? ??? ??? ?? ???????.
???? ?? ??????? ?????? ??? ?????? ????? ??????? ?????? ?????? Jet.
??? ????? ADO ???
??? ???? ??? ?? ????? ??? ??? ???????? ?????? ?? ADO ????? ????? ?????? Jet. ??? ???? ??????? ???? ??????? ??? ??????? ?? ???? ????? ????????? ???????? ?? ????? ?????? ?????? ?? ????? ???????? ???? ????? ??? ???????? ???? ????? ??? ??????. ???? ??? ??? ??????? ??? ??????? ???? Microsoft ????? ????? ADO ???? ??? ?????? ??? ??? ??????. ??? ???? ??????? ?? ????? ??? ????? ADO ??? ????? ?? ????? ????? ????? ???????.
???? ?????? ?????? ????? ??? ??????? ADO ??? ????? ?????? Microsoft Jet ??? ?????:
- ????? ????? ?????? ????? ?????.
- ??????? ????? ??????? ?? ??????? ????? ???????? Northwind.mdb.
- ???? ????? ??????? ?? ????? ????? "?????".
- ?? ?????? ????? ????? ???? ????? ??????? ??? ????? ????? ???????.
- ????? ????? "???_?????" ??????? ??? ????? ????? ??????:
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
- ?? ?????? ????????? ???????? ??????? ??? ????? ????? ????? ???????:
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
- ??? ??????? ?? ?? ?????? ????.
- ???? ????? ??????? ?? ????? ????? "?????".
- ????? ?? ????? ?? ??? ??? ?? ???????.
???? ?? ??????? ?????? ??? ?????? ????? ??????? ?????? ?????? Jet.
??????? ODBC
??? ??? ????? ??? ?????? ????? ADO ?????? ?????? ?? ????? ?????? ODBC ???? ??????? ??????? ?????:
- ??? ?? ?????? ????? ADO ????????? ?? ??? ?????? ??????? ???? OLEDB Microsoft ?? ODBC.
- ??? ?? ???? ????? ADO ???? ?? ???? ??????.
???? ?????? ?????? ????? ??? ADO ??????? ?????? ?????? ODBC "?" ??? ??? ?????.
??????: ????? ??? ??????? ?? ????? ?????? ODBC ????? ??? ???? ???? ??????? ????? ???? ?? ???? ???? ??????? ?? ????? ????? ???????? Northwind.mdb. ????? ????? ????? ODBC DSN ?????? MyDSN ?????? ?????? ????? ODBC ???? ????? ??? ??????? ?????? ?????? ??????? ???????.
- ???? ????? ????? ???????? Northwind.mdb.
- ???? ????? ??????? ?? ????? ????? "?????".
- ?? ?????? ????? ????? ???? ????? ??????? ??? ????? ????? ???????.
- ????? ????? "???_?????" ??????? ??? ????? ????? ??????:
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
- ?? ?????? ????????? ???????? ??????? ??? ????? ????? ????? ???????:
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
- ??? ??????? ?? ?? ?????? ????.
- ???? ????? ??????? ?? ????? ????? "?????".
- ????? ?? ????? ?? ??? ??? ?? ???????.
???? ?? ??????? ?????? ??? ?????? ????? ??????? ????? ??? ?????? ODBC.
??????? Oracle
??? ??? ????? ??? ?????? ????? ADO ?????? ?????? ?? ????? ?????? Oracle ???? ??????? ??????? ?????:
- ??? ?? ?????? ????? ADO ????????? ?? ??? ?????? ??????? ???? OLEDB Microsoft ?? Oracle.
- ??? ?? ???? ?????? ??????? ADO ???? ?? ???? ??????.
???? ?????? ?????? ????? ??? ADO ??????? ?????? ?????? Oracle ? ??? ??? ?????.
??????: ????? ??? ??????? ?? ????? ?????? Oracle ????? ??? ???? ???? ??????? ????? ???? ?? ???? ???? ??????? ?? ????? ????? ???????? Northwind.mdb.
- ???? ????? ????? ???????? Northwind.mdb.
- ???? ????? ??????? ?? ????? ????? "?????".
- ?? ?????? ????? ????? ???? ????? ??????? ??? ????? ????? ???????.
- ????? ????? "???_?????" ??????? ??? ????? ????? ??????:
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
- ?? ?????? ????????? ???????? ??????? ??? ????? ????? ????? ???????:
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
- ??? ??????? ?? ?? ?????? ????.
- ???? ????? ??????? ?? ????? ????? "?????".
- ????? ?? ????? ?? ??? ??? ?? ???????.
???? ?? ??????? ?????? ??? ?????? ????? ??????? ????? ??? ?????? Oracle.
?????? ??? ??????? ??????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
281784
(http://support.microsoft.com/kb/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
(http://support.microsoft.com/kb/281998/en-us/
)