Comments

: hai: how to save a row in a table when the same is deleted in another table in sql server.: : i am doing a project in vb.net. i am using a table called entry and a table called garbag.: when i delete a row in the table entry it must automatically be saved in the table garbag.: : is it possible?: : how do i code it?: : pls help me.: i am new to vb.net.: : thanks .: This will be a simple example you will have to fill in the detailsMainData will be the name of the Databaseopen the Entry table if not already open record 10 will be deleted-- fields are Name, Address, State and Zipdr=BindingContext(maindatadataset."entry").position this gets the position 10 for the rec. set to delete

Open the garbag table

rec=MainData.Garbag.count ' this gets the num. of record in garbag ie 100rec=rec+1 ' this becomes 101 maindatadataset.garbag.add ' this set up an add conditionmaindatadataset.garbag.rows(rec)("Name") = maindatadataset.entry.rows(dr)("Name")

maindatadataset.garbag.rows(rec)("Zip") = maindatadataset.entry.rows(dr)("Zip") '' this get the data in those field to the garbag fields

Garbagtableadapter.Update(maindatadataset.garbag) ' this saves the data to the new filed

You can now go ahead and finish your deletion of the tenth record in the Entry table.I've made this crude and simple but it works with any data base (Access,Sql,Oracle etc. etc.) Good luck.. Read up on some database theory.....