Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2014
    Posts
    8

    Unanswered: i wanted to join my excelsheet 2007 to mysql

    i getting an error while connecting to mysql using the vba code macro of ms excel 2007
    please let me know how would i connect to mysql

    Sub dbConnect()
    Dim strConn As String

    Dim dbConn As New ADODB.Connection
    Set dbConn = New ADODB.Connection

    strConn = "Provider={MySQL ODBC 5.2 Unicode Driver};Password=swamy;Persist Security Info=True;User ID=root;Data Source=my_ansi;Initial Catalog=wds"
    'strConn = "Provider=MSDASQL.1;Password=swamy;Persist Security Info=True;User ID=root;Data Source=mySQL32;Initial Catalog=wds"

    dbConn.Open wds = mySQL_UserDSN
    dbConn.Open strConn


    If dbConn.State = adStateOpen Then
    MsgBox "Connected"
    Else
    MsgBox "DB Connection Failed"
    End If
    dbConn.Close

    End Sub
    Last edited by baig; 03-25-14 at 06:28. Reason: i want to change some words

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Download the MySQL ODBC driver and you can then use it much like any other ODBC data source.

    https://www.mysql.com/products/connector/
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •