I am wanting to create a new spreadsheet programmatically using Delphi (which I can do).
What I can't do though is figure out how to set up the ODBC connection and insert a query from code. Is it possible?
I initially recorded a macro to see the VBA code, and then tried to duplicate it in Delphi.
This is what I'm trying :
with xls.WorkBooks[1].ListObjects.Add(0, 'ODBC;DSN=MySQL;', xls.WorkSheets[1].Range('$A$1')).QueryTable do
begin
CommandType := 0;
CommandText := 'SELECT 1';
...
end;
My very first error is that a record, object or class type is required on the very first line of this code.
I would appreciate any insght.
Thanks.
What I can't do though is figure out how to set up the ODBC connection and insert a query from code. Is it possible?
I initially recorded a macro to see the VBA code, and then tried to duplicate it in Delphi.
This is what I'm trying :
with xls.WorkBooks[1].ListObjects.Add(0, 'ODBC;DSN=MySQL;', xls.WorkSheets[1].Range('$A$1')).QueryTable do
begin
CommandType := 0;
CommandText := 'SELECT 1';
...
end;
My very first error is that a record, object or class type is required on the very first line of this code.
I would appreciate any insght.
Thanks.