Access to the remote data library

zhaozj2021-02-11  255

---- Remote Data Object (RDO) is an ODB-based object model based on the ODBC API, which is short, fast, strong, can access any 32-bit ODBC data source, such as SQL Server and Oracle database, is an update to the remote database More advanced tools.

---- The general method of using RDO is as follows.

---- First sound variables:

Public Con As Rdoconnection, RES As RdoreSultset

---- The default parameters such as RDOEngine, setup households and passwords are then initialized;

With rdoengine

.rdodefaultuser = "sa" "user is SA

.rdodefaultpassword = "pass" 'password is Pass

.rdodefaultcursordriver = rduServer

.rdodefaultlogintimeout = 15

End with

---- Connect to the remote data library to be interviewed (you can use DSN Connection and DSN-Less Connection).

---- Use the DSN Connection Example (Database Hotel on the Server Server):

Set con = rdoenvironments (0) .openConnection

("Hotel", RDDrivernoprompt, False)

---- Use DSN-Less Connection Example (Database Hotel on Server):

Set con = rdoenvironments (0) .openConnection

("", RDDrivernoprompt, false, _

Driver = {SQL Server};

Server = Server; Database = Hotel ")

---- After the connection, you can use the OpenResultSet method to check and process the results set, but also use the EXECUTE method to implement the data defense and the data operation in the internal operation. E.g:

SET RES = Con.openResultset

("Select * from menu", rdopenStatic)

Con. EXECUTE "CREATE VIEW MENU_VIEW AS SELECT code,

FROM MENU, RDEXECDIRECT

---- RDO's strongest and most important characteristics is: it can check and treat the results of the deposit of the deposit, and there is no more complicated.

---- In addition to RDO, you can also use RDC to access remote data libraries.

---- Remote Data Control (RDC) is similar to the data control (DC), and is not always the RDC to connect to the ODBC driver program system with RDO, while DC is connected to the Jet Database Engine with DAO. With RDO and RDC, there is no need to use Jet Engines to access the ODBC data source. This way, when visiting the remote data library, can achieve better performance and greater flexibility. ---- Remote data control MSRDC uses the first example.

Connect: driver = {sql server}; server = server; database = hotel

DataSourceName:

SQL: SELECT * FROM MENU

Username: SA

Password: pass

Cursordriver: 3-RDuseClient

---- You can use the RDC to perform a lot of simple remote data access, do not need to write any code, just fill in it, it can be used, which is used to use it. However, it should be noted that in addition to non-installation and only starting RDC when needed, it will consume a remote data library to connect. In the case of a restricted source of the remote data, it should be used with a very efficient situation, and use less RDC. In this case, you should consider using RDO, and use a storage process (pre-compiled SQL statement).

---- The upheld should also note that only 32-bit operation systems (such as Windows NT or Windows 95) can support RDO and RDC. RDO and RDC can only be used to access 32-bit ODBC data sources.