VBA Connection String won't connect to Go Daddy SQL Server DBase

I'm trying to test the connection of a Go Daddy 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


 End If

MsgBox canConnect

End Sub
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Should it be

User ID

i.e. with a space?
Brad Sims, CCNANetwork AdministratorCommented:
I think your "provider" attribute is incorrect.

For an OLEDB it should be Provider=SQLNCLI.

brohjoeAuthor Commented:
I got it working.  Here is the correct code:

Thanks for trying guys.

Dim cnn As ADODB.Connection
Dim objCommand As ADODB.Command
Dim canConnect As Boolean
Dim strCnn As String
Dim rsData As ADODB.Recordset
Dim strSQL As String

Public Sub Export()

Set cnn = New ADODB.Connection

strCnn = "Provider=sqloledb; Data Source=GoDaddyServer.com;Initial Catalog=devhybrid2;Uid=user; Password=pw;"
cnn.ConnectionString = strCnn
cnn.Open (strCnn)

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.