Board index » cppbuilder » Deleting table object deletes the actual table??

Deleting table object deletes the actual table??

BCB3,  Win95,  Paradox tables

When I created a form and dropped a few tables and datasources on it
all was well.  Then I decided I didn't need one of the Tables on this
form.

When I deleted the Table and DataSource objects from the form  the
actual database was deleted from the hard drive data and all.

Is this normal behavior

What is the proper way to remove a table you decide you don't need on
that form?

I know I have done this before without loosing data but now I am
afraid to try

Thanks
DeKayA

 

Re:Deleting table object deletes the actual table??


It didn't remove the underlying database.  You must be mistaken.

Quote
DeKayA <DeK...@bellsouth.net> wrote in message

news:38e31e5b.1019488@forums.inprise.com...
Quote
> BCB3,  Win95,  Paradox tables

> When I created a form and dropped a few tables and datasources on it
> all was well.  Then I decided I didn't need one of the Tables on this
> form.

> When I deleted the Table and DataSource objects from the form  the
> actual database was deleted from the hard drive data and all.

> Is this normal behavior

> What is the proper way to remove a table you decide you don't need on
> that form?

> I know I have done this before without loosing data but now I am
> afraid to try

> Thanks
> DeKayA

Re:Deleting table object deletes the actual table??


DeKayA,

Two things.  A question dealing with database issues is better to be asked
in either the Database newsgroup or the VCL.Components.Using newsgroup.  But
as for your question, deleting a table from a form WILL NOT delete the table
from the database.  The only way you can delete the table is through a query
or by calling TTable::DeleteTable().  If you are calling this method (and
you don't want the table delete) then this is bad.  To delete a table from a
form just use the "delete" operator:

    delete Table1;

If this is what you are doing perhaps you could post some of your code so
that it will be more clear to me (us).

- Clayton

Re:Deleting table object deletes the actual table??


Quote
>DeKayA,

>Two things.  A question dealing with database issues is better to be asked
>in either the Database newsgroup or the VCL.Components.Using newsgroup.

Since it was the IDE that did the deleting this seemed the appropriate
group.

Quote
> But as for your question, deleting a table from a form WILL NOT delete the table
>from the database.  

Well the bad news is it can and  IT DID.
Let me give you the whole scenario

First create a simple project.  add a table and tdatasource on the
form.
Assign the table to an existing table. and of course assign  the table
to the data source.   Now compile it. (It does nothing really) then
"Save All" and exit. (Makes sure the environment is updated.

Now restart the BCB IDE and the last project should come up.
(Assuming your IDE is configured to save the desktop on exit)
If not then just bring it up yourself.

Now Minimize the whole thing.
Yea that's right.  We are going two start to instances as you might do
if you were desiring to copy elements from one project to another

Now start a second instance of the BCB
bring up the same project.  
Now right click on the table object on the form and select Delete
table.  It should come up with a warning that the table is open
(by the other instance of the IDE)
At some point I exit and return to the finest instance and try to set
the table active and it declares the table doesn't exist.

I verify this with windows explorer and indeed the table is gone.

Better make sure you have a good backup of the table you are messing
with if you try this.

I did it twice.  Both times the table is deleted.

Quote
>...

>- Clayton

Re:Deleting table object deletes the actual table??


Quote
DeKayA wrote:
> Now right click on the table object on the form and select Delete
> table.  

This could be your problem, I think this may be saying 'Delete the
database table' rather than 'delete the table component'.  Any time I
want to delete a component on a form/datamodule, I simply select it with
the mouse and press the delete key.  I just tried deleting a component
your way in the BCB5 IDE (it's what I'm running right now) and I don't
even get a delete option.

AlisdairM

Re:Deleting table object deletes the actual table??


On Thu, 30 Mar 2000 17:19:47 +0100, AlisdairM

Quote
<"alisdair.meredith"@NO_SPAM_PLE...@benettonformula.com> wrote:
>DeKayA wrote:

>> Now right click on the table object on the form and select Delete
>> table.  

>This could be your problem, I think this may be saying 'Delete the
>database table' rather than 'delete the table component'.  Any time I
>want to delete a component on a form/datamodule, I simply select it with
>the mouse and press the delete key.  I just tried deleting a component
>your way in the BCB5 IDE (it's what I'm running right now) and I don't
>even get a delete option.

>AlisdairM

Still, you'd think that a confirmation would make some sense there....

Re:Deleting table object deletes the actual table??


DeKayA,

Quote
> Since it was the IDE that did the deleting this seemed the appropriate
> group.

I didn't realize you were deleting from within the IDE.  When you said "...
I deleted the Table and DataSource objects from the form ..."  I took this
to mean that you deleted it from the form at run-time...not at design time.
This newsgroup would indeed be the appropriate place to post this type of
question then.

Quote
> Yea that's right.  We are going two start to instances as you might do
> if you were desiring to copy elements from one project to another

There is an easier way of doing this (and less risky).  While in Builder go
to "View | Project Manager."  Now right click on the project manager node
(the root node) and choose "add existing project."  Add the project you're
going to copy the elements to or from.

Quote
> Now right click on the table object on the form and select Delete
> table.  It should come up with a warning that the table is open

As AlisdairM mentioned, this is your problem.  This is the IDE offering some
advanced techniques so that you can delete the table from the database
without having to go outside of Builder.  Personally I feel this feature is
not necessary.  The table is better deleted from within code or a database
software program.

For future reference, just delete the component like you would any other
component on a form.  Either select it and press the delete key on the
keyboard or choose delete from the menu.

- Clayton

Other Threads