 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
josuha Guest
|
Posted: Sun Dec 21, 2003 12:41 pm Post subject: paradox7 tables |
|
|
Hi all,
I have a little problem on the EmptyTable() method with the paradox7 tables.
Am doing an application in which i need to empty all the records in my
database table whenever the application loads. i should then be able to
refill this table with say a ButtonClick and use these new table values to
plot on a dbchart component. the little problem i have is that i am unable
to effect the EmptyTable() method! for the code below, i am getting a 'Table
is busy' exception, though on button click, the application goes on to
append the new values to the table without first emptying the table.
=====OnCreate event for the form=======
Table1->Active = false;
Table1->DatabaseName = "The_garment";
Table1->TableName = "Plot_option";
Table1->TableType = ttParadox;
Table1->EmptyTable();
file://my application is halting at this point and prompting for a re-run or
step execution.
======OnClick for Button1=============
file://here sg is the name of a string grid from which i want to fill my
dataset.
int a;
Table1->Active = true;
for (a=1; a<sg->RowCount; a++){
Table1->Edit();
Table1->Append();
Table1->FieldValues["Amv"] = sg->Cells[0][a];
Table1->Post();
}
Alternativelly, is it possible to empty only say one Field of a table
component??
cheers.
joshua
|
|
| Back to top |
|
 |
Antonio Felix Guest
|
Posted: Mon Dec 22, 2003 10:43 pm Post subject: Re: paradox7 tables |
|
|
Hi Joshua
Why don't you use a TQuery to perform a 'Delete from YourTable' ?
You could also use a query to empty the desired field, like:
Update 'YourTable' Set 'YourField' = ''
See the TQuery Help for more info
HTH
Antonio
"josuha" <mc_josh_vx (AT) yahoo (DOT) com> wrote
| Quote: | Hi all,
I have a little problem on the EmptyTable() method with the paradox7
tables.
Am doing an application in which i need to empty all the records in my
database table whenever the application loads. i should then be able to
refill this table with say a ButtonClick and use these new table values to
plot on a dbchart component. the little problem i have is that i am unable
to effect the EmptyTable() method! for the code below, i am getting a
'Table
is busy' exception, though on button click, the application goes on to
append the new values to the table without first emptying the table.
=====OnCreate event for the form=======
Table1->Active = false;
Table1->DatabaseName = "The_garment";
Table1->TableName = "Plot_option";
Table1->TableType = ttParadox;
Table1->EmptyTable();
file://my application is halting at this point and prompting for a re-run
or
step execution.
======OnClick for Button1=============
file://here sg is the name of a string grid from which i want to fill my
dataset.
int a;
Table1->Active = true;
for (a=1; a<sg->RowCount; a++){
Table1->Edit();
Table1->Append();
Table1->FieldValues["Amv"] = sg->Cells[0][a];
Table1->Post();
}
Alternativelly, is it possible to empty only say one Field of a table
component??
cheers.
joshua
|
|
|
| Back to top |
|
 |
bcb Guest
|
Posted: Tue Dec 23, 2003 9:44 pm Post subject: Re: paradox7 tables |
|
|
Hi Joshua
Make sure the Table you're emptying is not active during designtime. Only
open the table during runtime, and make sure no other TTable or TQuery has
the same table open, then the code you posted should work
Table1->Active = false;
Table1->DatabaseName = "The_garment";
Table1->TableName = "Plot_option";
Table1->TableType = ttParadox;
Table1->EmptyTable();
You can also try to set the exclusive property of the TTable to true before
emptying it out
Table1->Active = false;
Table1->DatabaseName = "The_garment";
Table1->TableName = "Plot_option";
Table1->TableType = ttParadox;
Table1->Exclusive = true;
Table1->EmptyTable();
|
|
| Back to top |
|
 |
|
|
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
|
|