Article View: borland.public.cppbuilder.database.ado
Article #2768Re: Multiple INSERT INTO statements
From: Jonny
Date: Wed, 02 Apr 2003 18:31
Date: Wed, 02 Apr 2003 18:31
74 lines
2931 bytes
2931 bytes
thanks i'll try that out tomorrow
Jonny
"Blazek Jaroslav" <Jaroslav.Blazek@access-it.cz> wrote in message
news:159ea77c.0304020454.41782a3@posting.google.com...
> Hi,
>
> /*------------- ADOQueryEx.h ----------------*/
> class PACKAGE TADOQueryEx : public TADOQuery
> {
> public:
> void __fastcall BeginFastAdd();
> void __fastcall EndFastAdd();
> };
>
> /*------------- ADOQueryEx.cpp --------------*/
>
> void __fastcall TADOQueryEx::BeginFastAdd()
> {
> if (!ComponentState.Contains(csLoading))
> Close();
> (dynamic_cast<TStringList *>(SQL))->OnChange = NULL;
> }
>
> void __fastcall TADOQueryEx::EndFastAdd()
> {
> (dynamic_cast<TStringList *>(SQL))->OnChange = QueryChanged;
> QueryChanged(SQL);
> }
>
> /*------------- example ------------*/
> ADOQueryEx->BeginFastAdd();
> try
> {
> ADOQueryEx->SQL->Clear();
> for (int i = 0; i < 1000; i++)
> ADOQueryEx->SQL->Add("INSERT MyTable (ColText) VALUES ('value')");
> }
> __finally
> {
> ADOQueryEx->EndFastAdd();
> }
>
> try
> {
> ADOQueryEx->ExecSQL();
> }
> catch(...)
> {
> ShowMessage("Error");
> }
>
> Bc. Jaroslav Blazek
> Access-IT Ceska Lipa
> Jaroslav.Blazek@access-it.cz
> http://www.access-it.cz
>
> "Jonny" <jonny@nospam.jonnywilk.co.uk> wrote in message
news:<b5vimu$ruo$1$8302bc10@news.demon.co.uk>...
> > Hi
> >
> > I've got an application that needs to insert serval values into a table
say
> > between 100-1000 rows. At the moment i've got an ADO connection to the
> > database, and then using an ADO Query i've got an INSERT INTO statement
> > that's placed in a for loop adding each row.
> >
> > This, however, is REALLY slow! What's the best way do this quickly
> >
> > Thanks
> >
> >
> > Jonny
Technical Details
Message-ID:
<b6fab7$56r$1$8300dec7@news.demon.co.uk>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mailReferences:
<b5vimu$ruo$1$8302bc10@news.demon.co.uk> <159ea77c.0304020454.41782a3@posting.google.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,4d999a3943779361 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-04-02 10:32:10 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: "Jonny" <jonny@nospam.jonnywilk.co.uk> Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: Multiple INSERT INTO statements Date: Wed, 2 Apr 2003 19:31:58 +0100 Lines: 76 Message-ID: <b6fab7$56r$1$8300dec7@news.demon.co.uk> References: <b5vimu$ruo$1$8302bc10@news.demon.co.uk> <159ea77c.0304020454.41782a3@posting.google.com> NNTP-Posting-Host: alanwilk.demon.co.uk X-Trace: news.demon.co.uk 1049308327 5339 80.177.110.156 (2 Apr 2003 18:32:07 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Wed, 2 Apr 2003 18:32:07 +0000 (UTC) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Priority: 3 X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MSMail-Priority: Normal