How To Do Database Programming With Visual Basic

Microsoft Visual Basic was made to make programming easy, and it also has many built-in parts that help a programmer connect to a database. One item from the toolbox that comes pre-installed with the Visual Basic software is the Microsoft ADO control. Once a database is set up, the Microsoft ADO control can be added to the Visual Basic program and can be used to connect to the database. Data in the database can then be manipulated with other Visual Basic controls or code.

Instructions

    • 1

      Create or locate a database to use with your Visual Basic program. If no database application program is available, Visual Basic comes with a simple database application, Visual Data Manager. The Visual Data Manager can be accessed from the "Tools" menu in Visual Basic.

    • 2

      Create a new Visual Basic application. This can be done when you start Visual Basic, or you can select "File...New" from the Visual Basic menu. Any application can work, but a stand-alone Visual Basic application will be easiest.

    • 3

      Add the Microsoft ADO control to the toolbox in Visual Basic. To do this, right-click on the toolbox and select "Components" from the shortcut menu. This will open a new window that will display a list of hundreds of controls. Scroll down to the item named "Microsoft ADO Control 6.0" and check that box. This will add the ADO control to the toolbox.

    • 4

      Double-click the ADO control in the toolbox to add the ADO control to your Visual Basic program.

    • 5

      Set the DataSource property of the ADO control to point to your database. When you click the property, another window will open that will assist connecting to the database.

    • 6

      Set the Source property of the ADO control to select a table or a number of records from the table. A standard SQL select statement can be used in this property.

    • 7

      Connect other Visual Basic controls to the ADO control by setting the DataSource property to the ADO control and the DataField property to the field from the SQL statement. The other Visual Basic controls will then display and edit data from the database.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured