Board index » delphi » DBase Index Files

DBase Index Files

I'm a beginner user of Delphi 3.0 and I need a suggestion about DBase
Index files.
I've seen that I can't insert two or more records with the same value
for Key Field
without obtain an error.
How can I do to resolve this problem ???

Thanks for your interest....

 

Re:DBase Index Files


You need to maintain an index on the primary key, then before you add
records to your table your code should check to see if a record with that
key already exists, by doing a seek on the primary key/index.  An index can
be made "unique" but this does not stop you adding a record with the same
key to the table, the effect will be that when this index is active you
will only see the first record with a given key value.

regards

Re:DBase Index Files


On Tue, 12 May 1998 23:20:44 +0200, Giancarlo GIAMPAOLO

Quote
<g.giampa...@flashnet.it> wrote:

RUn the Database Desktop, select Utilities from the pull-down menu,
then Re-Structure.  Your index may be set as "UNIQUE".  Un-check it.
Quote
>I'm a beginner user of Delphi 3.0 and I need a suggestion about DBase
>Index files.
>I've seen that I can't insert two or more records with the same value
>for Key Field
>without obtain an error.
>How can I do to resolve this problem ???

>Thanks for your interest....

Re:DBase Index Files


Yes.
BTW, a nice way to do this is to add a second TTable to the form
set to the same dbf and index as the first table and do the find
on that table.  That way you don't end up moving the current record
location in the first TTable (the one you are about to Post to).

Quote
Ren van Rullen wrote:

> You need to maintain an index on the primary key, then before you add
> records to your table your code should check to see if a record with that
> key already exists, by doing a seek on the primary key/index.  An index can
> be made "unique" but this does not stop you adding a record with the same
> key to the table, the effect will be that when this index is active you
> will only see the first record with a given key value.

> regards

--

Mark
mcapp...@mindspring.com

Re:DBase Index Files


You could use an autoinc. field, and mark it as one of the index-fields.

Good luck,
                Germ

Quote
Giancarlo GIAMPAOLO wrote in message <3558BD2B.5CE6...@flashnet.it>...
>I'm a beginner user of Delphi 3.0 and I need a suggestion about DBase
>Index files.
>I've seen that I can't insert two or more records with the same value
>for Key Field
>without obtain an error.
>How can I do to resolve this problem ???

>Thanks for your interest....

Other Threads