Go Daddy SQL Server connection test string using VBA inside Excel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brohjoe
    New Member
    • Mar 2010
    • 1

    Go Daddy SQL Server connection test string using VBA inside Excel

    I'm trying to connect to Go Daddy's SQL Server database using the following test connection string inside Excel, but I keep getting 'Run-time error '-2147217843 (80040e4d)' Invalid connection string attribute.'

    What is wrong with this VBA code?
    Code:
    Dim cnn As ADODB.Connection
    Dim canConnect As Boolean
    
    
    Public Sub TestConnection()
    
    Set cnn = New ADODB.Connection
    
    cnn.Open "Provider=sqloledb;Data Source=testdb.com;Initial Catalog=DBw; UserID=userID; Password='Password';"
    
    If cnn.State = adStateOpen Then
        canConnect = True
        cnn.Close
    End If
    
    MsgBox canConnect
    
    
    End Sub
    Any help would be appreciated. I've been searching online and looking for answers for some time now.
    Last edited by brohjoe; Mar 28 '10, 06:42 AM. Reason: correcting code
  • yarbrough40
    Contributor
    • Jun 2009
    • 320

    #2
    your data source attribute is wrong and there is a space between User and ID for starters... GoDaddy will give you the correct string. Log into your account. go to SQL Server. then click the pencil icon in the 'Action' box on the right. Then in the toolbar click 'Configuration'

    also it appears you have a lot of wrong syntax structure with your ADODB objects. you may want to google those

    Enjoy!

    Comment

    Working...