January 19th, 2012, 10:59 PM
I read data from IBM solidDB by using this code:
This works, but it writes DB column names into the first row and I don't want that. I can't figure out how to prevent that, not sure if that is possible to do at the first place. I have tried various other ways, but I don't seem to get them work with ODBC data source. I know this not a pure VB question but any constructive idea/feedback would be highly appreciated.
Dim ws As Worksheet
Set ws = Worksheets("Sheet2")
varConnection = "ODBC; DSN=solidDB; UID=dba; PWD=dba"
varSQL = "SELECT * FROM tsttable"
With ws.QueryTables.Add(Connection:=varConnection, Destination:=ws.Range("A1"))
.CommandText = varSQL
.Name = "Query-39008"