Re: Connect to SQL Server
- From: "Richard Mueller" <rlmueller-NOSPAM@xxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 13 Mar 2006 10:36:35 -0600
"Gary Watson" <GaryWatson@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1E1C4D36-26FD-4252-899B-CF72312DBF78@xxxxxxxxxxxxxxxx
More code details.
Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
strConnection = "Provider=SQLOLEDB.1;" & _
"Persist Security Info=False;Data Source=" & cboServers.Text & ";User
ID=" & txtUserid & _
";Initial Catalog=" & cboDatabases.Text & ";Data
Provider=SQLOLEDB.1;Password=" & txtPassword
cnn.Open strConnection ' test out login
I use:
strServer = "MyServer"
strInstance = "MyInstance"
strDB = "MyDatabase"
strConnect = "DRIVER=SQL Server;" _
& "Trusted_Connection=Yes;" _
& "DATABASE=" & strDB & ";" _
& "SERVER=" & strServer & "\" & strInstance
Set adoConnection = New ADODB.Connection
adoConnection.ConnectionString = strConnect
adoConnection.Open
If you connect to the default instance, omit the backslash and instance
name.
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
.
- Prev by Date: Re: i have a question about rename table through ADOX with C++
- Next by Date: Re: Connect to SQL Server
- Previous by thread: i have a question about rename table through ADOX with C++
- Next by thread: Re: Connect to SQL Server
- Index(es):
Relevant Pages
|
|