Database Programming Using VB 6.0 (Part One)
There are five main methods to connect the database using VB 6.0. VB 6.0 can be connected with all popular relational databases, such as Oracle, Microsoft Access and SQL servers.
- Data Control.
- ActiveX Data Object (ADO) Control.
- Data Environment Designer.
- Data Wizard.
- Open Database Connectivity (ODBC).
Database Prototype Programs using VB 6.0 are shown below by connecting with Microsoft SQL server except Data Control method. Data control cannot be used to connect the VB 6.0 with Microsoft SQL server. It can only be used to connect the VB 6.0 with Microsoft Access, Dbase, Excel, FoxPro and Paradox.
Data Control Method
These are the steps to connect the VB 6.0 with Microsoft Access server by using data control method:
-
Drag a data control, two text boxes, two label boxes and four command buttons from the toolbox on the form window.
-
Activate the data bound grid from the ActiveX components. Data bound grid file name is DBGRID32.ocx that can be viewed in the System32 folder of the Windows. ActiveX components can be selected and viewed by clicking on the ‘Project’ menu. Data bound grid icon will become a part of toolbox after activation. Drag the data bound grid control on the form window.
-
Design the GUI according to the requirements of the application.
-
Develop a database using Microsoft Access server.
-
Click on the tools menu to convert the database to its prior version. It is necessary to convert the MS Access server version 2000 to its prior version because VB 6.0 cannot be connected with MS Access server version 2000.
-
Select the data control. Click on the ‘DatabaseName’ property from the data control properties window to set the database path. Click the ‘RecordSource’ property from the properties window of the data control to select the table to be connected.
-
Select the first text box. Click on the ‘DataSource’ property from its properties window to select the data control. You can add more than one data control to a VB 6.0 standard project. Select the ‘DataField’ property to set the ‘booknumber’ field name.
-
Repeat the same procedure with second text box and select the ‘bookname’ field name.
-
Select the data bound grid control. Search its properties to select the data control from the ‘Datasource’ property.
-
Double click on the command buttons to write code.
Related posts:
- Database Programming Using VB 6.0 (Part Two) ActiveX Data Object (ADO) Control Method These are the steps...
- Database Programming Using VB 6.0 (Part Three) Data Environment Designer These are the steps to connect VB...
- Menu Programming and Multiple Form Programming Using VB 6.0 Menu Programming Using VB 6.0 A menu is a collection...
- DBMS Programming Languages-Database, Tables and Fields (Part Two) DBMS Programming Languages There are three types of database programming...
- VB 6.0 Programming and Integrated Development Environment of VB 6.0 VB 6.0 Programming Visual Basic (VB) was evolved from the...