
How to connect to SQL Server 6.5 using VB 5.0
This code use RDO to connect to Sql Server DataBase
without ODBC DSN, and in this case close the connection
immediately.
Dim cn As New rdoConnection
Dim ServerName As String
Dim DSName As String
Dim UID As String
Dim PWD As String
Dim Driver As String
Dim DataBase As String
DSName = " "
UID = "clinnet"
Driver = "{SQL Server}"
DataBase = "EMPI"
PWD = "oentry"
cn.Connect = "UID=" & UID & ";pwd=" & PWD & ";server=" & ServerName &
";driver=" & Driver & ";database=" & DataBase & ";DSN='';"
cn.CursorDriver = rdUseOdbc
cn.EstablishConnection rdDriverNoPrompt
cn.Close ' Close the connection.
=========
Quote:
>Can anybody provide me just a brief code snippet on how to connect to MS
SQL
>Server 6.5 using VB 5.0 Enterprise?
>Although I am not a newbie in Visual Basic, I am a newbie in Client/Server
>programming. Just as we would use the OpenDatabase method of the workspace
>object to 'link' to the database we want, what would be the equivalent if
>one were to use RDO to connect to a remote MS SQL Server 6.5?
>Can somebody give me a small code snippet that shows the works of
connecting
>and opening a database on a remote server, and then closing the connection?
>Thanks.
>Jonathan O.