1: Create procedure [dbo].[ClearAllUserInfo]
2: @UserId uniqueidentifier,
3: @WithTruncateCommonData bit = 0
4: as
5:
6: BEGIN TRY
7:
8:
9: Begin Tran
10: --удаляете все свое
11:
12: --- ...
13:
14: --собственно регистрация юзера
15: delete aspnet_Membership output deleted.* where UserID=@UserId
16: delete aspnet_Profile output deleted.* where UserID=@UserId
17: delete dbo.aspnet_UsersInRoles output deleted.* where UserID=@UserId
18: delete aspnet_Users output deleted.* where UserID=@UserId
19:
20:
21: If (@WithTruncateCommonData = 1)
22: BEGIN
23: -- чистка прочих журналов
24: truncate table SummarySiteCount
25: truncate table MyLog
26: END
27:
28:
29: If (@@Error=0) BEGIN
30: COMMIT
31: return 0
32: END
33: else BEGIN
34: rollback tran
35: return -1
36: END
37:
38: END TRY
39:
40: BEGIN CATCH
41: Select ERROR_MESSAGE() AS ErrorMessage
42: rollback tran
43: return -1
44: END CATCH
Comments (
)
Link to this page:
//www.vb-net.com/AspNet_UserManager/Clear.htm
|