BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to delete the data which double by quickly?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop)
View previous topic :: View next topic  
Author Message
Bpk. Adi Wira Kusuma
Guest





PostPosted: Thu Mar 17, 2005 6:22 pm    Post subject: How to delete the data which double by quickly? Reply with quote



I Use foxpro. My datas have been double. How to delete the data which double
by quickly? When I index with unique, data just still be double.

How to avoid the data double quickly and precisely?


Back to top
Dell Stinnett
Guest





PostPosted: Thu Mar 17, 2005 9:24 pm    Post subject: Re: How to delete the data which double by quickly? Reply with quote



Index on your key field(s), non-unique.

sKey := ''; //I'm using a string here - use whatever type your key field
is.
while not tMyTable.eof do
begin
if tMyTable.FieldByName('KEY_FIELD').AsString <> sKey then
begin
sKey := tMyTable.FieldByName('KEY_FIELD').AsString;
tMyTable.Next;
end
else
tMyTable.Delete;
end;

Note that you do NOT do tMyTable.Next after the tMyTable.Delete. Delete in
Delphi should automatically move the record pointer to the next record (I
know for sure that it does in non-xBase databases). You'll also have to
pack your table. There may be an easier way to do that, but the only way I
know of is to use the BDE function DbiPackTable. To see how to use this
you'll need to go to the BDE Online Reference help file - not the regular
Delphi help file.

-Dell


"Bpk. Adi Wira Kusuma" <adi_wira_kusuma (AT) yahoo (DOT) com.sg> wrote

Quote:
I Use foxpro. My datas have been double. How to delete the data which
double
by quickly? When I index with unique, data just still be double.

How to avoid the data double quickly and precisely?





Back to top
Bpk. Adi Wira Kusuma
Guest





PostPosted: Fri Mar 18, 2005 12:48 am    Post subject: Re: How to delete the data which double by quickly? Reply with quote



Thanks.

"Dell Stinnett" <dell.stinnett> wrote

Quote:
Index on your key field(s), non-unique.

sKey := ''; //I'm using a string here - use whatever type your key field
is.
while not tMyTable.eof do
begin
if tMyTable.FieldByName('KEY_FIELD').AsString <> sKey then
begin
sKey := tMyTable.FieldByName('KEY_FIELD').AsString;
tMyTable.Next;
end
else
tMyTable.Delete;
end;

Note that you do NOT do tMyTable.Next after the tMyTable.Delete. Delete
in
Delphi should automatically move the record pointer to the next record (I
know for sure that it does in non-xBase databases). You'll also have to
pack your table. There may be an easier way to do that, but the only way
I
know of is to use the BDE function DbiPackTable. To see how to use this
you'll need to go to the BDE Online Reference help file - not the regular
Delphi help file.

-Dell


"Bpk. Adi Wira Kusuma" <adi_wira_kusuma (AT) yahoo (DOT) com.sg> wrote in message
news:4239caa9 (AT) newsgroups (DOT) borland.com...
I Use foxpro. My datas have been double. How to delete the data which
double
by quickly? When I index with unique, data just still be double.

How to avoid the data double quickly and precisely?







Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.