MS Excel access with ZeosLib latest

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
C_R22
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 23.06.2006, 03:36

MS Excel access with ZeosLib latest

Post by C_R22 »

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.
Terence
Zeos Dev Team
Zeos Dev Team
Posts: 141
Joined: 22.09.2005, 14:11
Location: Stuttgart
Contact:

Post by Terence »

Did you run "ReadOnlyQuery.Execute" or "ReadOnlyQuery.Open"?
You should have done "Open."
fabian
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

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
Post Reply