Running a simple VBA script to test a connection
Posted
by brohjoe
on Stack Overflow
See other posts from Stack Overflow
or by brohjoe
Published on 2010-03-28T06:08:11Z
Indexed on
2010/03/28
6:13 UTC
Read the original article
Hit count: 317
I'm trying to test the connection of a GoDaddy SQL Server database. I'm getting an 'invalid connection string attribute.'
What's wrong with this script?
Dim cnn As ADODB.Connection
Dim canConnect As Boolean
Public Sub TestConnection()
Set cnn = New ADODB.Connection
cnn.Open "Provider=sqloledb;Data Source=GoDaddyServer.com;Initial Catalog=dBase1;UserID=userID; Password='password';"
If cnn.State = adStateOpen Then
canConnect = True
cnn.Close
End If
MsgBox canConnect
End Sub
© Stack Overflow or respective owner