Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have been using Excel to connect to a Simply Accounting SDB database. Now I switch to 2009 which uses MySQL. The connection method that I have been using doesn't work anymore. Appreciate if someone could show me how to do it. The way I have been using is like this: sDSN = "Simply Accounting: TestDB" With ActiveSheet.QueryTables.Add (Connection:="ODBC;DATABASE=TestDB;UID=john;PWD=12 34;DSN=" & sDSN, Destination:=Range("A1"), Sql:=sSQL) .FieldNames = bFieldname .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .PreserveColumnInfo = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlOverwriteCells .SavePassword = True .SaveData = True .AdjustColumnWidth = False .RefreshPeriod = 0 .PreserveColumnInfo = True .Refresh BackgroundQuery:=False End With Is it possible to just change the connection string? Thanks David |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can edit the code as required. if you changed the location or name of
the data source you'll have to edit the code. " wrote: Hi, I have been using Excel to connect to a Simply Accounting SDB database. Now I switch to 2009 which uses MySQL. The connection method that I have been using doesn't work anymore. Appreciate if someone could show me how to do it. The way I have been using is like this: sDSN = "Simply Accounting: TestDB" With ActiveSheet.QueryTables.Add (Connection:="ODBC;DATABASE=TestDB;UID=john;PWD=12 34;DSN=" & sDSN, Destination:=Range("A1"), Sql:=sSQL) .FieldNames = bFieldname .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .PreserveColumnInfo = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlOverwriteCells .SavePassword = True .SaveData = True .AdjustColumnWidth = False .RefreshPeriod = 0 .PreserveColumnInfo = True .Refresh BackgroundQuery:=False End With Is it possible to just change the connection string? Thanks David |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
xls to mysql | Excel Discussion (Misc queries) | |||
always recheck data connection library for latest connection strin | Excel Discussion (Misc queries) | |||
calling all pro's!!! macro that can modify dates in odbc connection to mysql | Excel Programming | |||
Connection to MySQL causes "Catastrophic failure" | Excel Programming | |||
connection to internet mysql-database | Excel Programming |