Click here to Skip to main content
16,017,857 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
hello iam maintaing three tables
Maintable1,table2,table3
tables are created at desing time not by queries execute.
table2,table2 are the foreign key tables under Maintable1.

My question is tables created at desing time so how to delete a record from Maintable1 at design time.How to do this?

provide examples with screens or example site with screens
Posted
Comments
_Maxxx_ 24-Aug-11 2:23am    
It's not clear what you are asking. You say the tables are created at "design time" - do you mean that you have created the tables through SQL Management Studio, or perhaps by running some "Create table" sql?

say the primary key value of a record in your MainTable is 123, so you have a record in table2 with a column MainTable1Key and a value of 123, and the same in table3
Then you should
Delete from table2 where Maintable1Key = 123
Delete from table2 where Maintable1Key = 123
Delete from Maintable where Key = 123

You asked "provide examples with screens or example site with screens"
which I completely don't understand?

 
Share this answer
 
Not sure what you mean by design time.

You cannot delete the parent record if it is a foreign key in any other table. That is the way keys are supposed to work. You need to delete all the child records first and then the parent record.
 
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