1ALTER PROCEDURE dbo.aspnet_Membership_GetUserByUserId --通过用户ID获取用户
2 @UserId UNIQUEIDENTIFIER,
3 @TimeZoneAdjustment INT,
4 @UpdateLastActivity BIT = 0
5AS
6BEGIN
7 IF ( @UpdateLastActivity = 1 )
8 BEGIN
9 DECLARE @DateTimeNowUTC DATETIME
10 EXEC dbo.aspnet_GetUtcDate @TimeZoneAdjustment, @DateTimeNowUTC OUTPUT
11 UPDATE dbo.aspnet_Users
12 SET LastActivityDate = @DateTimeNowUTC
13 FROM dbo.aspnet_Users
14 WHERE @UserId = UserId
15
16 IF ( @@ROWCOUNT = 0 ) -- User ID not found
17 RETURN -1
18 END
19 /*还是更新用户最近活动时间的,是某个用户的,ID为条件*/
20 SELECT m.Email, m.PasswordQuestion, m.Comment, m.IsApproved,
21 m.CreateDate, m.LastLoginDate, u.LastActivityDate,
22 m.LastPasswordChangedDate, u.UserName, m.IsLockedOut,
23 m.LastLockoutDate
24 FROM dbo.aspnet_Users u, dbo.aspnet_Membership m
25 WHERE @UserId = u.UserId AND u.UserId = m.UserId
26 /*这里好象就两个表连接,不知道为什么*/
27 IF ( @@ROWCOUNT = 0 ) -- User ID not found
28 RETURN -1
29
30 RETURN 0
31END
32
2 @UserId UNIQUEIDENTIFIER,
3 @TimeZoneAdjustment INT,
4 @UpdateLastActivity BIT = 0
5AS
6BEGIN
7 IF ( @UpdateLastActivity = 1 )
8 BEGIN
9 DECLARE @DateTimeNowUTC DATETIME
10 EXEC dbo.aspnet_GetUtcDate @TimeZoneAdjustment, @DateTimeNowUTC OUTPUT
11 UPDATE dbo.aspnet_Users
12 SET LastActivityDate = @DateTimeNowUTC
13 FROM dbo.aspnet_Users
14 WHERE @UserId = UserId
15
16 IF ( @@ROWCOUNT = 0 ) -- User ID not found
17 RETURN -1
18 END
19 /*还是更新用户最近活动时间的,是某个用户的,ID为条件*/
20 SELECT m.Email, m.PasswordQuestion, m.Comment, m.IsApproved,
21 m.CreateDate, m.LastLoginDate, u.LastActivityDate,
22 m.LastPasswordChangedDate, u.UserName, m.IsLockedOut,
23 m.LastLockoutDate
24 FROM dbo.aspnet_Users u, dbo.aspnet_Membership m
25 WHERE @UserId = u.UserId AND u.UserId = m.UserId
26 /*这里好象就两个表连接,不知道为什么*/
27 IF ( @@ROWCOUNT = 0 ) -- User ID not found
28 RETURN -1
29
30 RETURN 0
31END
32