Article View: borland.public.cppbuilder.database.ado
Article #1517Re: Append Key Violations
From: Nigel
Date: Mon, 03 May 2004 18:10
Date: Mon, 03 May 2004 18:10
29 lines
2143 bytes
2143 bytes
This sounds very strange to me why you want to do what you are asking, I
would relook at the keys I have created in the table and change them or
remove them completely (but I probably may not understand your question
fully). The other way is to use the Locate function of the table and only
append records that are not located
if(!Table1->Locate("KeyField","New Value",TLocateOptions()))
{
Table1->Append() //or Table1->Insert();
Table1->FieldByName("KeyField")="New Value";
Table1->Post();
}
"Robert Emmons" <remmons@aurigen.com> wrote in message
news:oe5460dfppnhmbe99n4500cudggmntqhet@4ax.com...
> I am using a TADOQuery to insert records in a Microsoft Access 2000
> (MSA) database table. If I run the query in MSA I get the opportunity
> to ignore any key violations and append the records which do not
> create key violations. However, I see no such option in the TADOQuery
> class. If there is a single key violation, it refuses to append *any*
> of the records.
>
> My work around is to use a select and delete query to delete the key
> violation records, but I'd prefer a simpler way.
>
> Is there a way or property to set the TADOQuery to append the records
> without key violations, and omit those with violations?
>
Technical Details
Message-ID:
<40968b14@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!controlnews3.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<oe5460dfppnhmbe99n4500cudggmntqhet@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,ffb97565c8ce78b9 X-Google-Attributes: gid10698b,public From: "Nigel" <nhussey@absamail.co.za> Newsgroups: borland.public.cppbuilder.database.ado References: <oe5460dfppnhmbe99n4500cudggmntqhet@4ax.com> Subject: Re: Append Key Violations Date: Mon, 3 May 2004 20:10:29 +0200 Lines: 31 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 196.39.50.168 Message-ID: <40968b14@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1083607828 196.39.50.168 (3 May 2004 11:10:28 -0700) Path: arc1-ca.pugleaf.net!controlnews3.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail