BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Get list of Excel Worksheets with ADO

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
eshipman
Guest





PostPosted: Wed Dec 17, 2003 5:16 pm    Post subject: Get list of Excel Worksheets with ADO Reply with quote



Need to be able to get a list of Worksheets in
an Excel Workbook with ADO.

ADOConnection1.ConnectionString :=
'Provider=MSDASQL.1;Persist ' +
'Security Info=False;Extended ' +
'Properties="DSN=My_Excel_File;' +
'DBQ=MyExcelFile.xls;DefaultDir=C:;' +
'DriverId=790;FIL=excel 8.0;' +
'MaxBufferSize=2048;PageTimeout=5;"';
ADOConnection1.Open;
ADOConnection1.GetTableNames(ExcelWorkBookNames);

Doesn't work...
Back to top
Viatcheslav V. Vassiliev
Guest





PostPosted: Wed Dec 17, 2003 5:28 pm    Post subject: Re: Get list of Excel Worksheets with ADO Reply with quote



Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:File.xls;Extended
properties=Excel 8.0

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi + ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"eshipman" <eshipman@yahoo!!!.com> ???????/???????? ? ???????? ?????????:
news:MPG.1a4a4b8285b7d376989754 (AT) forums (DOT) borland.com...
Quote:
Need to be able to get a list of Worksheets in
an Excel Workbook with ADO.

ADOConnection1.ConnectionString :=
'Provider=MSDASQL.1;Persist ' +
'Security Info=False;Extended ' +
'Properties="DSN=My_Excel_File;' +
'DBQ=MyExcelFile.xls;DefaultDir=C:;' +
'DriverId=790;FIL=excel 8.0;' +
'MaxBufferSize=2048;PageTimeout=5;"';
ADOConnection1.Open;
ADOConnection1.GetTableNames(ExcelWorkBookNames);

Doesn't work...



Back to top
eshipman
Guest





PostPosted: Wed Dec 17, 2003 5:39 pm    Post subject: Re: Get list of Excel Worksheets with ADO Reply with quote



In article <3fe09240 (AT) newsgroups (DOT) borland.com>, [email]support (AT) oledbdirect (DOT) com[/email]
says...
Quote:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:File.xls;Extended
properties=Excel 8.0

"eshipman" <eshipman@yahoo!!!.com> ???????/???????? ? ???????? ?????????:
news:MPG.1a4a4b8285b7d376989754 (AT) forums (DOT) borland.com...
Need to be able to get a list of Worksheets in
an Excel Workbook with ADO.

ADOConnection1.ConnectionString :=
'Provider=MSDASQL.1;Persist ' +
'Security Info=False;Extended ' +
'Properties="DSN=My_Excel_File;' +
'DBQ=MyExcelFile.xls;DefaultDir=C:;' +
'DriverId=790;FIL=excel 8.0;' +
'MaxBufferSize=2048;PageTimeout=5;"';
ADOConnection1.Open;
ADOConnection1.GetTableNames(ExcelWorkBookNames);

Doesn't work...

ADOConnection1.ConnectionString :=

'Provider=Microsoft.Jet.OLEDB.4.0;Persist ' +
'Security Info=False;Extended ' +
'Properties="DSN=My_Excel_File;' +
'DBQ=MyExcelFile.xls;DefaultDir=C:;' +
'DriverId=790;FIL=excel 8.0;' +
'MaxBufferSize=2048;PageTimeout=5;"';


Now, after that change, I get this error:
'Could not find installable ISAM'

Back to top
Viatcheslav V. Vassiliev
Guest





PostPosted: Wed Dec 17, 2003 7:46 pm    Post subject: Re: Get list of Excel Worksheets with ADO Reply with quote

No, exactly as I sayd, no DSN, no ODBC:

ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:File.xls;Extended properties=Excel 8.0';

(without line breaks).

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi + ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"eshipman" <eshipman@yahoo!!!.com> ???????/???????? ? ???????? ?????????:
news:MPG.1a4a50dd9ca0a5c6989755 (AT) forums (DOT) borland.com...
Quote:
In article <3fe09240 (AT) newsgroups (DOT) borland.com>, [email]support (AT) oledbdirect (DOT) com[/email]
says...
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:File.xls;Extended
properties=Excel 8.0

"eshipman" <eshipman@yahoo!!!.com> ???????/???????? ? ????????
?????????:
news:MPG.1a4a4b8285b7d376989754 (AT) forums (DOT) borland.com...
Need to be able to get a list of Worksheets in
an Excel Workbook with ADO.

ADOConnection1.ConnectionString :=
'Provider=MSDASQL.1;Persist ' +
'Security Info=False;Extended ' +
'Properties="DSN=My_Excel_File;' +
'DBQ=MyExcelFile.xls;DefaultDir=C:;' +
'DriverId=790;FIL=excel 8.0;' +
'MaxBufferSize=2048;PageTimeout=5;"';
ADOConnection1.Open;
ADOConnection1.GetTableNames(ExcelWorkBookNames);

Doesn't work...

ADOConnection1.ConnectionString :=
'Provider=Microsoft.Jet.OLEDB.4.0;Persist ' +
'Security Info=False;Extended ' +
'Properties="DSN=My_Excel_File;' +
'DBQ=MyExcelFile.xls;DefaultDir=C:;' +
'DriverId=790;FIL=excel 8.0;' +
'MaxBufferSize=2048;PageTimeout=5;"';


Now, after that change, I get this error:
'Could not find installable ISAM'



Back to top
eshipman
Guest





PostPosted: Wed Dec 17, 2003 7:51 pm    Post subject: Re: Get list of Excel Worksheets with ADO Reply with quote

In article <MPG.1a4a4b8285b7d376989754 (AT) forums (DOT) borland.com>,
[email]eshipman@yahoo!!!.com[/email] says...
Quote:
Need to be able to get a list of Worksheets in
an Excel Workbook with ADO.

ADOConnection1.ConnectionString :=
'Provider=MSDASQL.1;Persist ' +
'Security Info=False;Extended ' +
'Properties="DSN=My_Excel_File;' +
'DBQ=MyExcelFile.xls;DefaultDir=C:;' +
'DriverId=790;FIL=excel 8.0;' +
'MaxBufferSize=2048;PageTimeout=5;"';
ADOConnection1.Open;
ADOConnection1.GetTableNames(ExcelWorkBookNames);

Doesn't work...


This works:

ADOConnection1.ConnectionString :=
'Provider=MSDASQL.1;Persist ' +
'Security Info=False;Extended ' +
'Properties="DSN=My_Excel_File;' +
'DBQ=MyExcelFile.xls;DefaultDir=C:;' +
'DriverId=790;FIL=excel 8.0;' +
'MaxBufferSize=2048;PageTimeout=5;"';
ADOConnection1.Open;
ADOConnection1.OpenSchema(siTables, EmptyParam,
EmptyParam, ADODataSet1);
ADODataSet1.DisableControls;
ADODataSet1.Open;
while not ADODataset1.Eof do
begin
ExcelWorkBookNames.Add(ADODataSet1.fields[2].value);
ADODataset1.Next;
end;
ADODataset1.Close;
ADODataSet1.EnableControls;
ADOConnection1.Close;


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.