Asked By
roanmitch
0 points
N/A
Posted on - 05/22/2013
Good Day,
I want to know how to connect using MS SQL and Visual basic 6.0.
Most of the time I used Access database, but I want a database that can handle a large data so I choose an MS SQL database.
Please help me what is the connection string.
How to connect MS SQL and Visual Basic 6.0
Well,
Just refer to ADO this is done by going through menu ->project->preferences. Then check the check box of Microsoft Active X Data Objects 2.X Library. (MDACÂ Installed).
Then establish connection objects by this command set. The intensive will give you this utility, so install it.
Dim    connection     As       New    ADODB.Connection
Dim    Command      As       New    ADODB.Command
Then have login follow these steps (command)
Connection.ConnectionString = "driver={SQL Server};server=YOURSERVER;uid=YOURUSER;pwd=YOUPASSÂ WORD;database=YOURDATABASE"
Connection.Open
Command.ActiveConnection = Connection
Procedure Call by this command
Dim ResultSet As New ADODB.Recordset
Command.CommandText = "YOURPROCEDURE"
Set ResultSet = Command.Execute
Work with your results
Dim value as String
If ResultSet.BOF = True And ResultSet.EOF = True Then
Value = ResultSet. Fields (0)
End If