Database Connectivity Using RDO
Database Connectivity Using RDO
Database Connectivity Using RDO
RDO uses ODBC (Open Data Base Connectivity), an ODBC Data Source, which must be set up through
the Windows Control Panel. Follow the steps below to set up an ODBC Data Source (this process is also
called "setting up a DSN", where "DSN" stands for "Data Source Name").The following steps is used to
setup system DSN as:
1.) Go to Start -> Windows Control Panel; double-click on Administrative Tools, then Data
Sources (ODBC). The ODBC Data Source Administrator screen is displayed. Click on the
System DSN tab.
2.) Click the Add button. The Create New Data Source dialog box will appear. Select Microsoft
Access Driver (*.mdb) from the list and click the Finish button.
3.) The ODBC Microsoft Access Setup dialog box will appear. For Data Source Name, type
Biblio. If desired, you can type an entry for Description, but this is not required.
4.) Click the Select button. The Select Database dialog box appears. On a default installation of
VB6 or Visual Studio 6, the BIBLIO.MDB sample database should reside in the folder
C:\Program Files\Microsoft Visual Studio\VB98. Navigate to that folder, select BIBLIO.MDB
from the file list, and click OK.
5.) When you are returned to the ODBC Microsoft Access Setup screen, the database you selected
should be reflected as shown below. Click OK to close this screen.
6.) When you are returned to the ODBC Data Source Administrator screen, the new DSN should
appear as shown below. Click OK to close this screen.
1.) Start a new VB project, and from the Components dialog box (invoked from the Project ->
Components menu), select Microsoft Remote Data Control 6.0 (SP3) as shown below and
click OK.
2.) Drag & Drop a remote data control (RDC) on your form, and set the properties as follows:
Property Value
Name MSRDC1
DataSourceName Select the DSN name as created above. Eg. Biblio
SQL select * from Customers
3.) Now put three text boxes on the form, and set their Name, DataSource, and DataField properties
as follows:
4.) Save and run the program. It works just like the other data control.
Code for Add, delete, edit, update, movefirst, movenext, first, last
operations on the click event of command button:
MSRDC1.Resultset.AddNew
End Sub
======================
MSRDC1.Resultset.Delete
End Sub
MSRDC1.Resultset.MoveFirst
End Sub
MSRDC1.Resultset.Update
End Sub
Private Sub Command5_Click()
MSRDC1.Resultset.Edit
End Sub
MSRDC1.Resultset.MovePrevious
End Sub
MSRDC1.Resultset.MoveFirst
End Sub
MSRDC1.Resultset.MoveLast
End Sub