about-knowledge.com

rss

Database Programming Using VB 6.0 (Part Two)

without comments

ActiveX Data Object (ADO) Control Method

These are the steps to connect the VB 6.0 with MS SQL server using ADO control:

  • Activate the Microsoft ADO control and Data Grid control 6.0 from the ActiveX components. ADO and Data Grid Control icons will become part of toolbox after activation.

  • Drag ADO control, Data grid control 6.0, two text boxes, two label boxes and two command buttons from the toolbox on the form window.

  • Design the GUI, as is done using Data Control method.

  • Develop a database and table using MS SQL server. Structured Query Language (SQL) and Query By Example (QBE) are two methods to develop a database using Microsoft SQL server. QBE method is shown below to develop a database using Microsoft SQL server:

  1. Select the Microsoft SQL server and click on the Enterprise Manager icon from the programs menu.

  2. Click on the Microsoft SQL server Group.

  3. Click on the server name.

  4. Click on the new database icon. Enter the name of the database, such as ‘books’ and Press OK button.

  5. Double click on the folder name ‘Databases’. New SQL server database has been created.

  6. Double click on the ‘books’ database icon to design tables physically.

  7. Design a new table using mouse right click event on the ‘Tables’ icon.

  8. Enter the field names of the tables. Select the primary key using the key icon from the tool bar. Press ’save’ icon to save the table.

  9. Enter the table name and press OK button.

  10. Open table name ‘BookRecord’ to enter data by using the mouse right click event. Database is ready to connect with VB 6.0.

  • Select the ADO control and click on the properties using mouse right click event.

  • Press the build button to select the MS SQL server driver.

  • Press the next button to select the MS SQL server name and database to connect. Click on the option box to connect the server to use Windows NT Integrated security.

  • Press the Test Connection button to verify that database is connected or not.

  • Press OK button on the test connection message.

  • Press OK button on the data link connection window to complete the database connection procedure.

  • Select the ‘RecordSource’ tab to connect the table.

  • Select command type ‘2-adcmdtable’ from the first combo box control and table ‘BookRecord’ from the second combo box control.

  • Press ‘Apply’ and then ‘OK’ buttons to complete the table connection procedure.

  • VB 6.0 connection procedure with MS SQL server using ADO control method is completed.

  • Select the first text box. Click on the ‘DataSource’ property from its properties window to select the ADO control. 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 Grid control 6.0. Search its properties to select the ADO control from the ‘DataSource’ property.

  • Double click on the command buttons to write code.

Bookmark and Share

Related posts:

  1. Database Programming Using VB 6.0 (Part Three) Data Environment Designer These are the steps to connect VB...
  2. Database Programming Using VB 6.0 (Part One) There are five main methods to connect the database using...
  3. Menu Programming and Multiple Form Programming Using VB 6.0 Menu Programming Using VB 6.0 A menu is a collection...
  4. Selection Programming and Sub Procedure Programming Using VB 6.0 Selection Programming Using VB 6.0 Selection is a method of...
  5. Programming of Facts Programmer declares Facts by writing Predicate first and then fact...

Written on

May 12th, 2009 at 6:29 pm