문제

When I use Membership.DeleteUser(userName, false) nothing happens. But When I use Membership.DeleteUser(userName, true) or Membership.DeleteUser(userName) error is thrown.

The DELETE statement conflicted with the REFERENCE constraint "FK__aspnet_Pr__UserI__3F115E1A".
The conflict occurred in database "MyDB", table "dbo.aspnet_Profile", column 'UserId'.

Here is my table key structures:

enter image description here

enter image description here

enter image description here

enter image description here

Can anybody help me out in solving this issue.?Not getting any idea.

도움이 되었습니까?

해결책

Use ON DELETE CASCADE

it will specify whether you want rows deleted in a child table when corresponding rows are deleted in the parent table. If you do not specify cascading deletes, the default behavior of the database server prevents you from deleting data in a table if other tables reference it.

see http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.sqls.doc/sqls292.htm

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top