How to Connect MS SQL Server and Visual Basic 6.0

June 15, 2012 // In: VB 6.0

Today, I’m going to show you how to connect SQL Server database using VB 6.0. Just follow the instructions.

Note down your database name and table along with its fields to work with. We’ll connect through ADODB.
Just follow the steps..

1. Open Visual Studio and Create a new standard project.
2. Goto Project menu and Click on References
3. select Microsoft ActiveX Data Objects 2.0 Library and Press OK button.

4. Now Lets Suppose we have database with the name “SharpCoders” and a table with the name “tbl_users” (username, password)
5. Place 2 text boxes, and a command button on the form.

6. Copy and paste following code.

 

Hide Windows with Source Code ( VB 6.0 )