Click here to Skip to main content
15,896,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Good Evening,

I have problem to delete record from transaction table.


i have two table which are given below.


1.ItemMaster(itemId(pk),ItemDescription,Remarks)

2.Transaction(TransactionId(pk),transactiontype,Itemid(FK),TransactionDate,Remarks)


both table have record,when i try to delete ItemMaster Record which is assign to transaction record then its give me the foreign key conflict thats right.but if i try to delete a transaction table record then also give same foreign key conflict.

so please give me solution to how i delete transaction record.

thanks
Posted
Comments
NuttingCDEF 26-Apr-11 6:45am    
From what you say, it sounds as though it should work. Are you sure the Transaction table doesn't participate in any other relationships that could be causing the problem? Exactly what error message do you get? How are you doing the delete? SQL Management Studio, Linq to Sql or what? Are you doing this in a SQL transaction and, if so, is there anything else going on in the transaction that could be an issue? Can you dump some SQL CREATE code for your tables / relationships that we could look at?

If you want delete records with foreignkey relation

1st you can delete in child table records.
 
Share this answer
 
hi,,

Go to relationship window by modifying table
on the bottom there is insert and update specification, in that change delete rule to cascade for each relation. by doing this it will delete the child node too ..

happy coding
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900