| View previous topic :: View next topic |
| Author |
Message |
Pedram Guest
|
Posted: Wed Oct 26, 2005 12:49 pm Post subject: Remove a Record |
|
|
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
|
Posted: Wed Oct 26, 2005 2:04 pm Post subject: Re: Remove a Record |
|
|
"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
|
Posted: Wed Oct 26, 2005 10:38 pm Post subject: Re: Remove a Record |
|
|
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
|
Posted: Fri Oct 28, 2005 4:14 pm Post subject: Re: Remove a Record |
|
|
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 |
|
 |
|