January 19th, 2012, 11:59 PM
I read data from IBM solidDB by using this code:
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"
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.