Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to "undo" a database delete

Reply
Thread Tools

How to "undo" a database delete

 
 
Morgan Bachu
Guest
Posts: n/a
 
      08-30-2005
Hello everybody,

I have an intranet application which is mostly a bunch of data editing
forms.

The database has about 20 tables all related together.

Recently somebody deleted a "the wrong record" and the cascade delete
in sql server did its work nicely

When they asked me to put the data back, I looked pretty stupid
as I had no idea how.

How is this normally done in ASP.NET app?

Morgan

 
Reply With Quote
 
 
 
 
Lau Lei Cheong
Guest
Posts: n/a
 
      08-30-2005
I supposed this is not quite an ASP.NET related question, it's more database
related.

So you should tell us what database you're using.And if you're using MSSQL,
you'll get better chance being answered if you're posting in
microsoft.public.sqlserver.server newsgroup.

"Morgan Bachu" <(E-Mail Removed)>
???????:(E-Mail Removed) egroups.com...
> Hello everybody,
>
> I have an intranet application which is mostly a bunch of data editing
> forms.
>
> The database has about 20 tables all related together.
>
> Recently somebody deleted a "the wrong record" and the cascade delete
> in sql server did its work nicely
>
> When they asked me to put the data back, I looked pretty stupid
> as I had no idea how.
>
> How is this normally done in ASP.NET app?
>
> Morgan
>



 
Reply With Quote
 
 
 
 
Hans Kesting
Guest
Posts: n/a
 
      08-30-2005
Morgan Bachu wrote:
> Hello everybody,
>
> I have an intranet application which is mostly a bunch of data editing
> forms.
>
> The database has about 20 tables all related together.
>
> Recently somebody deleted a "the wrong record" and the cascade delete
> in sql server did its work nicely
>
> When they asked me to put the data back, I looked pretty stupid
> as I had no idea how.
>
> How is this normally done in ASP.NET app?
>
> Morgan


If it's deleted from the database, then it is gone (no "recycle bin")!
Time to check if the backup procedure really works, I'm afraid.

Hans Kesting


 
Reply With Quote
 
tom pester
Guest
Posts: n/a
 
      08-30-2005

What database is it ? Sql server, Access, ...

Let me know if you have any more questions...

Cheers,
Tom Pester

> Hello everybody,
>
> I have an intranet application which is mostly a bunch of data editing
> forms.
>
> The database has about 20 tables all related together.
>
> Recently somebody deleted a "the wrong record" and the cascade delete
> in sql server did its work nicely
>
> When they asked me to put the data back, I looked pretty stupid as I
> had no idea how.
>
> How is this normally done in ASP.NET app?
>
> Morgan
>



 
Reply With Quote
 
Lau Lei Cheong
Guest
Posts: n/a
 
      08-30-2005
I remember that if it's MS Access or so, when the record is deleted but not
packed, there's some change to recover...

"Hans Kesting" <(E-Mail Removed)> ¼¶¼g©ó¶l¥ó·s»D:e5Y5W$(E-Mail Removed) bl...
> Morgan Bachu wrote:
>> Hello everybody,
>>
>> I have an intranet application which is mostly a bunch of data editing
>> forms.
>>
>> The database has about 20 tables all related together.
>>
>> Recently somebody deleted a "the wrong record" and the cascade delete
>> in sql server did its work nicely
>>
>> When they asked me to put the data back, I looked pretty stupid
>> as I had no idea how.
>>
>> How is this normally done in ASP.NET app?
>>
>> Morgan

>
> If it's deleted from the database, then it is gone (no "recycle bin")!
> Time to check if the backup procedure really works, I'm afraid.
>
> Hans Kesting
>
>



 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      08-30-2005

What I would do is set up an identical set of tables, prefaced
"bk_thetablename" and store any records deleted in *that* set of tables.

Kind of like an audit trail.

That way, although you delete records,
you still keep all records, deleted or not, permanently.




Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Morgan Bachu" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Hello everybody,
>
> I have an intranet application which is mostly a bunch of data editing
> forms.
>
> The database has about 20 tables all related together.
>
> Recently somebody deleted a "the wrong record" and the cascade delete
> in sql server did its work nicely
>
> When they asked me to put the data back, I looked pretty stupid
> as I had no idea how.
>
> How is this normally done in ASP.NET app?
>
> Morgan
>



 
Reply With Quote
 
tom pester
Guest
Posts: n/a
 
      08-30-2005

In sql server you can undelete it by examening the transaction log. There
are tools to make it easy.

A general approuch it to take backups so you can go back in time or do the
undelete manualy with some copy & pasting.

Cheers,
Tom Pester

> Morgan Bachu wrote:
>
>> Hello everybody,
>>
>> I have an intranet application which is mostly a bunch of data
>> editing forms.
>>
>> The database has about 20 tables all related together.
>>
>> Recently somebody deleted a "the wrong record" and the cascade delete
>> in sql server did its work nicely
>>
>> When they asked me to put the data back, I looked pretty stupid as I
>> had no idea how.
>>
>> How is this normally done in ASP.NET app?
>>
>> Morgan
>>

> If it's deleted from the database, then it is gone (no "recycle bin")!
> Time to check if the backup procedure really works, I'm afraid.
>
> Hans Kesting
>



 
Reply With Quote
 
tom pester
Guest
Posts: n/a
 
      08-30-2005

Or you could do a soft delete. When the user deletes a row you flip a switch
in a column, so :

delete from table where id = 8
becomes
update table set deleted = true

You can make it transparent for the developer by making a view of the table
like this :

Employees_All : a table that has also the deleted records
Employees : SELECT * FROM Employees where deleted = false

Let me know if you have any more questions...

Cheers,
Tom Pester

> What I would do is set up an identical set of tables, prefaced
> "bk_thetablename" and store any records deleted in *that* set of
> tables.
>
> Kind of like an audit trail.
>
> That way, although you delete records,
> you still keep all records, deleted or not, permanently.
> Juan T. Llibre
> ASP.NET MVP
> http://asp.net.do/foros/
> Foros de ASP.NET en Español
> Ven, y hablemos de ASP.NET...
> ======================
> "Morgan Bachu" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) oups.com...
>
>> Hello everybody,
>>
>> I have an intranet application which is mostly a bunch of data
>> editing forms.
>>
>> The database has about 20 tables all related together.
>>
>> Recently somebody deleted a "the wrong record" and the cascade delete
>> in sql server did its work nicely
>>
>> When they asked me to put the data back, I looked pretty stupid as I
>> had no idea how.
>>
>> How is this normally done in ASP.NET app?
>>
>> Morgan
>>



 
Reply With Quote
 
=?Utf-8?B?TG9naWNhTHVuYXRpYw==?=
Guest
Posts: n/a
 
      08-30-2005
Morgan,

This isn't so much of an ASP.NET question as it is an application design
question.

If an application I build allows the user to delete anything it is at most
only a logical delete. Basically I have a field in each table named
isDeleted. If set to true then that row is 'logically' deleted when it comes
to the application but the data is still there.

In one case I even created a Deleted Items page so the admins could go see
what's been deleted and 'un-delete' anything they wanted to.

"Morgan Bachu" wrote:

> Hello everybody,
>
> I have an intranet application which is mostly a bunch of data editing
> forms.
>
> The database has about 20 tables all related together.
>
> Recently somebody deleted a "the wrong record" and the cascade delete
> in sql server did its work nicely
>
> When they asked me to put the data back, I looked pretty stupid
> as I had no idea how.
>
> How is this normally done in ASP.NET app?
>
> Morgan
>
>

 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      08-30-2005
That is a viable database design idea, too.



Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"tom pester" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed). com...
>
> Or you could do a soft delete. When the user deletes a row you flip a switch in a
> column, so :
>
> delete from table where id = 8
> becomes
> update table set deleted = true
>
> You can make it transparent for the developer by making a view of the table like this :
>
> Employees_All : a table that has also the deleted records
> Employees : SELECT * FROM Employees where deleted = false
>
> Let me know if you have any more questions...
>
> Cheers,
> Tom Pester
>
>> What I would do is set up an identical set of tables, prefaced
>> "bk_thetablename" and store any records deleted in *that* set of
>> tables.
>>
>> Kind of like an audit trail.
>>
>> That way, although you delete records,
>> you still keep all records, deleted or not, permanently.
>> Juan T. Llibre
>> ASP.NET MVP
>> http://asp.net.do/foros/
>> Foros de ASP.NET en Español
>> Ven, y hablemos de ASP.NET...
>> ======================
>> "Morgan Bachu" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed) oups.com...
>>
>>> Hello everybody,
>>>
>>> I have an intranet application which is mostly a bunch of data
>>> editing forms.
>>>
>>> The database has about 20 tables all related together.
>>>
>>> Recently somebody deleted a "the wrong record" and the cascade delete
>>> in sql server did its work nicely
>>>
>>> When they asked me to put the data back, I looked pretty stupid as I
>>> had no idea how.
>>>
>>> How is this normally done in ASP.NET app?
>>>
>>> Morgan
>>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
To delete or not to delete? Lethal Computer Support 15 07-24-2005 11:47 PM
Can someone tell me why I can't delete this file? and why it blue screens WinXP Pro on delete? zZz Computer Support 1 01-12-2005 02:37 AM
Cannot Delete, (The Delete Key Won't Work) Lee Something Computer Support 13 10-15-2003 09:51 PM



Advertisments