🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Selecting data from an Excel spreadsheet into a database table.

#1449
From: Viatcheslav V. Vassiliev
Date: Mon, 14 Jun 2004 13:03
56 lines
2607 bytes
$ is special sign, use:

From sheet:

Select * from [$Sheet1]

From named diapason:

Select * from [DiapasonName]

From range:

Select * from [Sheet1$B5:C10]

Use also Jet provider. Connection string is:

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

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

"Peter Nunn" <pnunn@infoteq.com.au> ???????/???????? ? ???????? ?????????:
news:bo3rc0defgrbhs3covm9ld7sv9r9s3ke9i@4ax.com...
> Hi folks,
>
> I'm struggling with an app in which I need to update a database with
> data stored in an Excel spreadsheet.
>
> I've done a bit of hunting around on the net and it seems that some
> sort of ODBC connection would be the best way to do this (easier than
> parsing the spread sheet line by line) but I can't seem to get it to
> work for me.
>
> I've setup a system DSN for the spreadsheet (although it would be nice
> not to have to do this), pointed a TADOConnection compenonent to that
> and set active true (so far so good).
>
> When I add a TADOTable however and connect that to the ADOConnection I
> don't see any of the workbooks in the table list.
>
> I tried adding Sheet1$ to the table name (from the net) but when I set
> active here I get an error
>
> Syntax error in from clause.
>
> Any ideas what I should be doing please?
>
> ta.
> Peter.
>
Technical Details
Message-ID: <40cda214@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!lnewsoutpeer01.lnd.ops.eu.uu.net!lnewsinpeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <bo3rc0defgrbhs3covm9ld7sv9r9s3ke9i@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,2eabea38f2dfa61
X-Google-Attributes: gid10698b,public
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <bo3rc0defgrbhs3covm9ld7sv9r9s3ke9i@4ax.com>
Subject: Re: Selecting data from an Excel spreadsheet into a database table.
Date: Mon, 14 Jun 2004 17:03:17 +0400
Lines: 58
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 213.234.218.42
Message-ID: <40cda214@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1087218196 213.234.218.42 (14 Jun 2004 06:03:16 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!lnewsoutpeer01.lnd.ops.eu.uu.net!lnewsinpeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail