Posted: 11/14/2009
hi
i have one problem
i have three tables named QuestionTable which have the primarey ker question_id
which refrances
two other tables named as Answer and Exam_Quesion so when i want to delete the data from question table then
no data had dellted and exception is occuering
please help me thanks
naval kishor pandey
Hi, NavalYes you can't delete data from your parent table until you have data in your child tables. You have foreign key on your child tables which points to primary key in the main table so thats why you can t delete directly from parent table having primary key. If you are still in dilemma then please post some test data . Thanks,Raghav
Hi, Naval
Yes you can't delete data from your parent table until you have data in your child tables. You have foreign key on your child tables which points to primary key in the main table so thats why you can t delete directly from parent table having primary key. If you are still in dilemma then please post some test data .
Thanks,
Raghav
Hi Naval,If you want to delete the data from Question(Parent table) then first you need to delete data from Answer,Exam_Question (Child table) like:
Delete from Answer where QuestionId=@QuestionID Delete from Exam_Question where QuestionId=@QuestionID Delete from Question where QuestionId=@QuestionID
Thanks
Mr. Vijendar and raghav
My problem is solved.
naval kishor Pandey
Cool.