I have put the following components on my form and set various properties as this:
TZReadOnlyQuery:
Connection: ZConnection1
Datasource: DataSource1
SQL: SELECT * FROM [Sheet1$];
DataSource: All default properties
TZConnection:
Database: Provider=MSDASQL.1;Persist Security Info=False;Mode=ReadWrite;Extended Properties="DSN=Excel Files;DBQ=C:\DataBook.xls;DefaultDir=C:;DriverId=790;MaxBufferSize=2048;PageTimeout=5;"
Protocol: ado
DBGrid:
DataSource: DataSource1
Now when I click the TZReadOnlyQuery's Active property to True, it seems to execute the SQL fine - the TZConnection becomes connected, but nothing appears in the DBGrid, even though the correct file: c:\DataBook.xls exists, and has data in Sheet1.
It is connecting fine to the sheet, because I've tried at run time doing: .GetTableNames('', MyStrList); - then adding this to a Memo, and it's returning all the names of the Excel sheets in the file.
Basically, I'm just wondering how to connect and manipulate a Excel file. What am I doing wrong to run SQL queries on it? (I know you can run SQL queries on an Excel sheet with ADO).
Thanks.
MS Excel access with ZeosLib latest
Moderators: gto, cipto_kh, EgonHugeist
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Fabian,
C_R22 is just setting the components 'active' property to true. So that question is a little 'misplaced'.
C_R22,
Did you try this query from an other language before? (VB, VBA, ...) I'm not an ADO expert, but isn't there something like defining a dataset/database/range/??? in Excel? I can't imagine ADO can decide automa(t)(g)icaly what are the column names . Certainly not for a * select.
But I can be totally wrong, of course.
Mark
C_R22 is just setting the components 'active' property to true. So that question is a little 'misplaced'.
C_R22,
Did you try this query from an other language before? (VB, VBA, ...) I'm not an ADO expert, but isn't there something like defining a dataset/database/range/??? in Excel? I can't imagine ADO can decide automa(t)(g)icaly what are the column names . Certainly not for a * select.
But I can be totally wrong, of course.
Mark