Is there a way to get ADODB to work with Excel for Mac 2011?

后端 未结 3 1602
半阙折子戏
半阙折子戏 2020-12-11 17:52

I can not seem to get my Excel workbook (using ADODB) to work with Excel Mac 2011. I am using ADODB code. Are there add-ins available? Even from a third-party? Has anyone go

3条回答
  •  感情败类
    2020-12-11 18:26

    ADODB is NOT supported in Mac Excel 2011, but ODBC works in conjunction with a 3rd party driver.

    I got my ODBC drivers from ActualTech. Download and install their program and you'll have the necessary drivers for connecting to SQL servers and databases (Free to try, $35 to purchase).

    The following code creates a connection to a mySQL database, and returns information from the database into Cell A1:

    Dim connstring as String
    Dim sqlstring as String
    
    connstring = "ODBC;DRIVER={Actual Open Source Databases};" _
    & "SERVER=;DATABASE=;" _
    & "UID=;PWD=;Port=3306"
    sqlstring = "select * from "
    
    With ActiveSheet.QueryTables.Add(Connection:=connstring, Destination:=Range("A1"), Sql:=sqlstring)
      .BackgroundQuery = False
      .Refresh
    End With
    

提交回复
热议问题