to delete user form users table and the user have roles in roles table
i get this exception
The DELETE statement conflicted with the REFERENCE constraint "fk". The conflict occurred in database "app_data", table "Roles_table", column 'user_id'.
The statement has been terminated.
I'm assuming the Roles_table is a table you manually created in the same database as the membership tables, is that correct? If so, before you call the Membership.DeleteUser method, you'll need to delete all the records in the Roles_table where the userId
is equal to the id of the user you are deleting.
Touti
Member
91 Points
46 Posts
Delete User form membership table and roles table
Feb 22, 2013 08:49 PM|LINK
When i use
to delete user form users table and the user have roles in roles table
i get this exception
The DELETE statement conflicted with the REFERENCE constraint "fk". The conflict occurred in database "app_data", table "Roles_table", column 'user_id'.
The statement has been terminated.
and thanks for your help
michaelalex7
Member
170 Points
35 Posts
Re: Delete User form membership table and roles table
Feb 22, 2013 09:06 PM|LINK
Have you tried:
Reference: http://msdn.microsoft.com/en-us/library/w6b0zxdw.aspx
Touti
Member
91 Points
46 Posts
Re: Delete User form membership table and roles table
Feb 22, 2013 09:14 PM|LINK
Yes still none
michaelalex7
Member
170 Points
35 Posts
Re: Delete User form membership table and roles table
Feb 22, 2013 09:19 PM|LINK
I'm assuming the Roles_table is a table you manually created in the same database as the membership tables, is that correct? If so, before you call the Membership.DeleteUser method, you'll need to delete all the records in the Roles_table where the userId is equal to the id of the user you are deleting.
Hope this works :-)
Touti
Member
91 Points
46 Posts
Re: Delete User form membership table and roles table
Feb 22, 2013 09:24 PM|LINK
the table Roles is Created by the Membership Provider and i have no idea how i can access the data using EF
any Idea how i can access the Roles Using EF and delete related data?
michaelalex7
Member
170 Points
35 Posts
Re: Delete User form membership table and roles table
Feb 22, 2013 09:33 PM|LINK
I just found this via googling
..., it may be relevant to your issue
http://stackoverflow.com/questions/473060/asp-net-membership-deleteuser
Touti
Member
91 Points
46 Posts
Re: Delete User form membership table and roles table
Feb 22, 2013 09:52 PM|LINK
i use it tike this :
and the both roles and users table value deleted but the the value in webpages_membership table is not ?