🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1164

Re: How to Access Excel File by ADOQuery

#1164
From: Viatcheslav V. Vassiliev
Date: Tue, 12 Oct 2004 10:24
64 lines
2380 bytes
Use connection string:

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

Query is:

From sheet:
Select * from [Sheet1$]

in some cases $ - after name, in other - before, i.e. $Sheet1

From named diapason:
Select * from [DiapasonName]

From range:
Select * from [Sheet1$B5:C10]

//------------------------------------------
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)

"FlyR" <john.wild@msa.hinet.net> �������/�������� � �������� ���������:
news:416b493e@newsgroups.borland.com...
> my ADOQuery Control set as follow.
>
>   object Query: TADOQuery
>     ConnectionString =
>       'Provider=MSDASQL.1;Persist Security Info=False;Data Source=Data
>     Parameters = <>
>     Left = 48
>     Top = 40
>   end
>
>
>
>
> void __fastcall TForm1::Button1Click(TObject *Sender)
> {
> AnsiString SqlStr;
>
> SqlStr="Select * from ImageDataBase";
> Query->SQL->Clear();
> Query->SQL->Add(SqlStr);
> Query->Open();
>
> Query->Append();
> Query->FieldValues[0] ="test";
> Query->Post();
> }
>
> then I add a ODBC data source for Excel file. The Data Soruce name is
> "Data".
>
>
> I Excute this program. It has something wrong. But I cant solve it. Please
> help me.
> Thanx.
>
>
Technical Details
Message-ID: <416bb0c8@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <416b493e@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,417b4be6798e6a92
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <416b493e@newsgroups.borland.com>
Subject: Re: How to Access Excel File by ADOQuery
Date: Tue, 12 Oct 2004 14:24:07 +0400
Lines: 66
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 213.234.218.42
Message-ID: <416bb0c8@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1097576648 213.234.218.42 (12 Oct 2004 03:24:08 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail