Re: ADOtable Excel

From: Bob_M (Stardate10_at_hotmail.com)
Date: 06/30/04


Date: Wed, 30 Jun 2004 08:51:35 -0400

Ok I tried this, when I set active to True I get an error stating it couold
not find object $Sheet1. Thanks Bob

 ADOTable := TADOTable.create(application);
  ADOTable.ConnectionString :=
     'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\test.xls;Extended
Properties=Excel 8.0';
  try
    (* Read Section title Data *)
    ADOTable.TableName := '[$Sheet1]';
    ADOTable.active := True;
  finally
    ADOTable.Free;

"Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
news:40e2645f@newsgroups.borland.com...
> TableName := '[$Sheet1]'
> or
> TableName := '[NamedDiapason]' //place diapason name
>
> Query could be:
>
> From ***:
> Select * from [$Sheet1]
>
> From named diapason:
> Select * from [DiapasonName]
>
> From range:
> Select * from [Sheet1$B5:C10]
>
>
> Cell A1 probably will be column name, B1 will be on the first row etc.
>
> //------------------------------------------
> Regards,
> Vassiliev V. V.
> http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
> ADO.Net
> http://www.oledbdirect.com - The fastest way to access MS SQL Server,
> MS Jet (Access) and Interbase (through OLEDB)
>
> "Bob_M" <Stardate10@hotmail.com> сообщил/сообщила в новостях следующее:
> news:40e1cc33$1@newsgroups.borland.com...
> > Hello All,
> >
> > I would like to read the a few cells for data from an Excel file. I
have
> > done this with ADO and Access but can't get it to work with Excel.
Below
> is
> > my code. How would I get cell A1 from sheet1? Thanks Bob
> >
> > ADOTable := TADOTable.create(application);
> > ADOTable.ConnectionString :=
> > 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\test.xls;Extended
> > Properties=Excel 8.0';
> >
> > try
> > (* Read Section title Data *)
> > ADOTable.TableName := '[Sheet1]';
> > ADOTable.active := True;
> > finally
> > ADOTable.Free;
> > end;
> >
> >
>
>


Quantcast