Who is online? 97 guests and 0 members
Member login | Become a member
Posted: 11/14/2009 7:03:23 AM
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
Posted: 11/14/2009 7:28:28 AM
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
Posted: 11/14/2009 10:37:15 AM
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
Posted: 11/14/2009 10:39:55 AM
Thanks
Mr. Vijendar and raghav
My problem is solved.
naval kishor Pandey
Posted: 11/14/2009 12:41:20 PM
Cool.