Article View: borland.public.cppbuilder.database.ado
Article #116Re: import excel file to access database
From: Vassiliev V. V.
Date: Mon, 03 Sep 2007 17:18
Date: Mon, 03 Sep 2007 17:18
72 lines
3797 bytes
3797 bytes
Set ParamCheck to false. Otherwise it treats :anything as parameter, in this case c:\myxls.xls. Use also ExecSQL - this query does not return any data. //------------------------------------------ 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) "Tomislav Hundric'" <rifnet@gmail.com> �������/�������� � �������� ���������: news:46dc2b02@newsgroups.borland.com... > First of all thank you on your answer and sorry for my late response, > I'm using ADOConnection and ADOQuery, so I've tried to enter code you've > posted to SQL of ADOQuery, but I can't seem to make connection to excel > file. > > using your code: > > > INSERT INTO MyTable(Col1, Col2) > > SELECT Col1, Col2 > > FROM [Sheet1$] IN ""[Excel 8.0;Database=c:\myxls.xls] > > and changing ADOQuery1->Active = false to ADOQuery1->Active = true > > I get error: "Parameter object is improperly defined. Inconsistent or > incomplete information was provided." > > First I thought quotation marks were misplaced, but I've tried every > possible position without success. > > > I get the syntax, but don't know what to define in from clause, do I need > to add something else like : > FROM [Sheet1$] IN ['Microsoft.Jet.OLEDB.4.0', > 'Excel 8.0;Database=C:\testing.xls;'] > > Thanks in advance, > Tomislav. > > > Vassiliev V. V. wrote: >> Connect to Access database and execute: >> >> INSERT INTO MyTable(Col1, Col2) >> SELECT Col1, Col2 >> FROM [Sheet1$] IN ""[Excel 8.0;Database=c:\myxls.xls] >> >> [Sheet1] - named diapason, [Sheet1$] - sheet (if it does not work, try >> [$Sheet1]), [Sheet1$B5:C10] - cells range. >> >> //------------------------------------------ >> 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) >> >> >> "Tomislav Hundric'" <rifnet@gmail.com> �������/�������� � �������� >> ���������: news:46dae1d4$1@newsgroups.borland.com... >>> Please help, >>> I need to populate database table from excel file. My database table has >>> same fields as excel file has columns. I use ADO connection to connect >>> to database. Can anyone give me some guide lines or example how to do >>> this. >>> >>> Thanks in advance. >>
Technical Details
Message-ID:
<46dc41e1$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<46dae1d4$1@newsgroups.borland.com> <46dbd9c5@newsgroups.borland.com> <46dc2b02@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,da0a6137b1dabb49 X-Google-Attributes: gid10698b,public,usenet X-Google-Language: ENGLISH,ASCII From: "Vassiliev V. V." <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <46dae1d4$1@newsgroups.borland.com> <46dbd9c5@newsgroups.borland.com> <46dc2b02@newsgroups.borland.com> Subject: Re: import excel file to access database Date: Mon, 3 Sep 2007 21:18:21 +0400 Lines: 73 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-RFC2646: Format=Flowed; Response X-Antivirus: avast! (VPS 000772-0, 03.09.2007), Outbound message X-Antivirus-Status: Clean NNTP-Posting-Host: 85.93.138.132 Message-ID: <46dc41e1$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1188839905 85.93.138.132 (3 Sep 2007 10:18:25 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail X-Original-Bytes: 3525