How to connect Vb6 with SQL2000
|
|||
|
Rank: ? (2)
Member #: 27652 |
I am new to vb, i only know to connect vb with Access using DAO.To connect with SQL 2000 which connectvity to be used and how please help me.
|
||
|
|||
|
|||
|
Rank: ? (1)
Member #: 27977 |
1�refers to :
Microsoft Activex Data Objects Recordset 2.6 Library Microsoft Activex Data Objects 2.6 Library 2� Public conn As New ADODB.Connection Public rs As New ADODB.Recordset Dim mag As String On Error GoTo strerrmag Set conn = New ADODB.Connection Set rs = New ADODB.Recordset conn.ConnectionString = "Driver={sql server};server=" 192.168.1.4 & ";uid=" sa ";pwd=" 123456 ";database=" test"" conn.ConnectionTimeout = 30 conn.Open addFlag = True Exit Function strerrmag: mag = "can't open database " Call MsgBox(mag, vbOKOnly + 16, "error" addFlag = False |
||
|
|||
|
|||
|
Rank: ? (3)
Member #: 28625 |
First Add ADO
Microsoft Activex Data Objects 2.6 Library Public xCn As New ADODB.Connection On Error GoTo dbaseError xCn.ConnectionTimeout = 0 xCn.CommandTimeout = 0 xCn.Provider = "SQLOLEDB" xCn.Properties("Data Source" xCn.Properties("Initial Catalog" xCn.Properties("User Id" xCn.Properties("Password" xCn.CursorLocation = adUseClient xCn.Open Msgbox "Connection Success" dbaseError: Msg Box "connection Failed" |
||
|
Please login or register to post a reply.