Article View: borland.public.cppbuilder.database.ado
Article #5118Re: clearing a Query
From: Hien Tran
Date: Tue, 17 Jul 2001 02:07
Date: Tue, 17 Jul 2001 02:07
37 lines
2093 bytes
2093 bytes
Try this:
String sqlPart1 = "insert into Table1 (Name) values ";
String sqlPart2 = Format("'%s', OPENARRAY(TVarRec, (Name)));
String sqlStatement = sqlPart1 + sqlPart2;
Form1->ADOQuery1->Close();
Form1->ADOQuery1->SQL->Clear();
Form1->ADOQuery1->SQL->Add(sqlStatement);
Form1->ADOQuery1->ExecSQL();
Hope this help.
"Guy" <guy_kariv@hotmail.com> wrote in message news:3b518911_1@dnews...
> I would like to know how can I use the same TADOQuery component for more
> then one Query ? (tried to use clear function but it just didn't work)
>
> My source code looks like this:
>
> Form1->ADOQuery1->Parameters->ParamByName("parameter1")->Value =
> Name;
> Form1->ADOQuery1->Close();
> Form1->ADOQuery1->SQL->Clear();
> Form1->ADOQuery1->SQL->Add("insert into Table1 (Name) values
> (:parameter1)");
> Form1->ADOQuery1->ExecSQL();
>
> When I try to use this function more than one time, it seems that Clear()
> doesn't work and therefore ExecSQL stucks because it gets
> two rows.
>
> In addition to that, how can I write the Query at design time in the SQL
> property ? (This should solve the problem, I guess)
>
> Thanks Guy
>
>
Technical Details
Message-ID:
<3b539e7d_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.icl.net!newsfeed1.cidera.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsReferences:
<3b518911_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,4d93d397933a85e1 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-07-16 19:14:13 PST From: "Hien Tran" <hien@camgsm.com.kh> Newsgroups: borland.public.cppbuilder.database.ado References: <3b518911_1@dnews> Subject: Re: clearing a Query Date: Tue, 17 Jul 2001 09:07:48 +0700 Lines: 39 Organization: CAMGSM X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 NNTP-Posting-Host: 203.41.58.8 Message-ID: <3b539e7d_2@dnews> X-Trace: dnews 995335805 203.41.58.8 (16 Jul 2001 19:10:05 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.icl.net!newsfeed1.cidera.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews