[VISUAL BASIC CON BASE DE DATOS]
Leccion 6 – Usando RDO Página 1
Introduction to ODBC and RDO
Open Database Connectivity (ODBC) provides a set of application programming interface (API) functions whichmake it easier for a developer to connect to a wide range of database formats. ODBC gives the developer amethod of designing programs that are not specific to database format whether you are using Oracle, SQLServer, Access, or others. ODBC drivers are DLLs that contain the functions that let you connect to variousdatabases. Each ODBC driver is separate for each database format. ODBC drivers take the code from a programand convert the functions to the specific database format being used. RDO (Remote Data Objects) is a thin layerof code that acts as an ODBC "wrapper", enabling the developer to invoke ODBC functionality using familiarobject method and property syntax.
The "Alphabet Soup" of Database Access
Prior to VB6 and the introduction of ADO (ActiveX Data Objects), VB programmers would generally use DAO(Data Access Objects) to interact with local databases such as MS Access and use RDO (Remote Data Objects)to interact with client/server databases such as Oracle and SQL Server. The concept behind ADO was UniversalData Access (UDA), where one database access method could be used for any data source; it was designed toreplace both DAO and RDO. DAO remains a viable technology for interacting with MS Access databases as it isfaster than ADO for that purpose; however, ADO is more flexible â€“ using ADO, one could develop a prototypedatabase application using MS Access in the back-end, and with a "flick of the wrist" (i.e., with very little codingchanges) "upsize" that same application to use Oracle or SQL Server. As far as RDO is concerned, no newversions of it have been developed beyond the version that shipped with VB6, and there are no future plans for it.In the VB4 and VB5 worlds, RDO was the main method used to interact with client/server databases. RDO worksperfectly fine with VB6, so when folks migrated their VB5 applications over to VB6, little or no coding changeswere required. However, ADO is the preferred method of database access for new VB6 applications .
About this Tutorial
This tutorial presents three small sample applications using RDO. All three applications use a local MS Accessdatabase, as this is suitable for illustrative purposes; in actual practice, RDO would not be a suitable choice forinteracting with a local MS Access database. You could approach these sample applications "as if" the localAccess database was an Oracle or SQL Server database sitting on a server somewhere â€“ the codingtechniques are the same.
The first sample application introduces the RDO Data Control (RDODC) which demonstrates a "quick and dirty"way to connect to a remote database. The second and third applications use RDO code: the second allowsnavigation and searching of a database table; the third allows navigation and updating on a database table. Allthree connect to an ODBC Data Source, which must be set up through the Windows Control Panel. How to dothis is described below.