Can anyone help me by giving out a complete tutorial on the step by step way a connecting to a database using VB?

commented: Its forum not VB6 +0

hello Awais
try this code

Dim cn As ADODB.Connection 'ADODB Connection Object
        Dim rs As New ADODB.Recordset 'Recordset Object
        Dim sqlStr As String ' String variable to store sql command
        Set cn = New ADODB.Connection
        cn.ConnectionString = "Provider = MSDASQL;" & _
            "Data Source=LocalServer;" & _
            "Initial Catalog=sample;" & _
            "Login ID=SERVANT;" & _
            "Driver=SQL Server;"

 'your code        

Note that is for connect ur frontend with sql database server

hi awaise ali,

to connect with data base first we need the sql connection.

so we write a connection string. to write a connection string first creat a connection variable like this

dim con as new sqlconnection

next we need the connection string that indicate the sql server

that is like
dim costring as string

constring="server=servername;userid=your suer id;password=your password;database="your database name"

after this you need to connect with the server

con=new sqlconnection(constring)

now u r connected with the data base server

after this 'for open the connection

do your command here