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

cnn.Close

 End If

MsgBox canConnect

End Sub
brohjoeAsked:
Who is Participating?
 
brohjoeConnect With a Mentor Author 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

0
 
j-horbCommented:
Should it be

User ID

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

For an OLEDB it should be Provider=SQLNCLI.

http://help.godaddy.com/article/2718
http://www.connectionstrings.com/sql-server-2005
0
All Courses

From novice to tech pro — start learning today.