Running a simple VBA script to test a connection
- by brohjoe
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