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 

Remove a Record

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (Desktop)
View previous topic :: View next topic  
Author Message
Pedram
Guest





PostPosted: Wed Oct 26, 2005 12:49 pm    Post subject: Remove a Record Reply with quote



Hi, I got crazy but I still couldn't delete a Record in my Database.
For example I have a Table with a test.db which contains 10 records.
I wana delete the code that is the Current code in runtime.
Table1->SetKey();
Table1->FieldByName("Code")->AsInteger=MyInt;
Table1->GotoKey();
// Table1-> ... how could I remove the record?


Back to top
Antonio Felix
Guest





PostPosted: Wed Oct 26, 2005 2:04 pm    Post subject: Re: Remove a Record Reply with quote




"Pedram" <irbus (AT) remove-me-bonbon (DOT) net> wrote:
Quote:
Hi, I got crazy but I still couldn't delete a Record in my Database.
For example I have a Table with a test.db which contains 10 records.
I wana delete the code that is the Current code in runtime.
Table1->SetKey();
Table1->FieldByName("Code")->AsInteger=MyInt;
Table1->GotoKey();
// Table1-> ... how could I remove the record?




Hi Pedram

if ( Table1->GotoKey() )
Table1->Delete;

HTH
Antonio



Back to top
Pedram
Guest





PostPosted: Wed Oct 26, 2005 10:38 pm    Post subject: Re: Remove a Record Reply with quote



Hi !!!
Thanks for your reply
do you (or anyone else) know what is different between the Antonio easy way
and my new found way:
if ( Table1->GotoKey() )
DataSource1->DataSet->Delete();
When I test ot both of them are working OK.
But I guess my way , may loos some less than miliseconds and RAM address
that may be fatal in tones of records.
Am I rights?

@};- thanks again


"Antonio Felix" <nomail (AT) nm (DOT) pt> wrote

Quote:

"Pedram" <irbus (AT) remove-me-bonbon (DOT) net> wrote:
Hi, I got crazy but I still couldn't delete a Record in my Database.
For example I have a Table with a test.db which contains 10 records.
I wana delete the code that is the Current code in runtime.
Table1->SetKey();
Table1->FieldByName("Code")->AsInteger=MyInt;
Table1->GotoKey();
// Table1-> ... how could I remove the record?




Hi Pedram

if ( Table1->GotoKey() )
Table1->Delete;

HTH
Antonio





Back to top
Jayme Jeffman Filho
Guest





PostPosted: Fri Oct 28, 2005 4:14 pm    Post subject: Re: Remove a Record Reply with quote

Hi,

If you have a lot of records to delete you can use an SQL delete command :
"DELETE FROM table WHERE table_field = field_value", you do not
need a TQuery to Execute the command, use your TDatabase component
if you have dropped down one or the Session-Database, which is from the
TDatabase class. Have a look at the TDatabase::Execute() method in the
Help file.

HTH

Jayme.


"Pedram" <irbus (AT) remove-me-bonbon (DOT) net> escreveu na mensagem
news:43622968 (AT) newsgroups (DOT) borland.com...
Quote:
Hi !!!
Thanks for your reply
do you (or anyone else) know what is different between the Antonio easy
way
and my new found way:
if ( Table1->GotoKey() )
DataSource1->DataSet->Delete();
When I test ot both of them are working OK.
But I guess my way , may loos some less than miliseconds and RAM address
that may be fatal in tones of records.
Am I rights?

@};- thanks again





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder 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.