![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
1
ALTER PROCEDURE dbo.aspnet_Membership_GetUserByName --通过用户名获取用户
2
@ApplicationName NVARCHAR(256),
3
@UserName NVARCHAR(256),
4
@TimeZoneAdjustment INT,
5
@UpdateLastActivity BIT = 0
6
AS
7
BEGIN
8
IF (@UpdateLastActivity = 1)--更新最近活动
9
BEGIN
10
DECLARE @DateTimeNowUTC DATETIME
11
EXEC dbo.aspnet_GetUtcDate @TimeZoneAdjustment, @DateTimeNowUTC OUTPUT
12
UPDATE dbo.aspnet_Users
13
SET LastActivityDate = @DateTimeNowUTC
14
FROM dbo.aspnet_Applications a, dbo.aspnet_Users u
15
WHERE LOWER(@ApplicationName) = a.LoweredApplicationName AND
16
u.ApplicationId = a.ApplicationId AND
17
u.LoweredUserName = LOWER(@UserName)
18![](/Images/OutliningIndicators/None.gif)
19
IF (@@ROWCOUNT = 0) -- Username not found
20
RETURN -1
21
END
22
/*如果更新活动时间为真,设置最近活动时间为当前时间*/
23![](/Images/OutliningIndicators/None.gif)
24
SELECT m.Email, m.PasswordQuestion, m.Comment, m.IsApproved,
25
m.CreateDate, m.LastLoginDate, u.LastActivityDate, m.LastPasswordChangedDate,
26
u.UserId, m.IsLockedOut,m.LastLockoutDate
27
FROM dbo.aspnet_Applications a, dbo.aspnet_Users u, dbo.aspnet_Membership m
28
WHERE LOWER(@ApplicationName) = a.LoweredApplicationName AND
29
u.ApplicationId = a.ApplicationId AND
30
u.LoweredUserName = LOWER(@UserName) AND
31
u.UserId = m.UserId
32
/*三表连接查询(aspnet_Users/aspnet_Applications/aspnet_Membership好象有连就
33
要连一起)*/
34
IF (@@ROWCOUNT = 0) -- Username not found
35
RETURN -1
36
37
RETURN 0
38
END
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/None.gif)
9
![](/Images/OutliningIndicators/None.gif)
10
![](/Images/OutliningIndicators/None.gif)
11
![](/Images/OutliningIndicators/None.gif)
12
![](/Images/OutliningIndicators/None.gif)
13
![](/Images/OutliningIndicators/None.gif)
14
![](/Images/OutliningIndicators/None.gif)
15
![](/Images/OutliningIndicators/None.gif)
16
![](/Images/OutliningIndicators/None.gif)
17
![](/Images/OutliningIndicators/None.gif)
18
![](/Images/OutliningIndicators/None.gif)
19
![](/Images/OutliningIndicators/None.gif)
20
![](/Images/OutliningIndicators/None.gif)
21
![](/Images/OutliningIndicators/None.gif)
22
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
23
![](/Images/OutliningIndicators/None.gif)
24
![](/Images/OutliningIndicators/None.gif)
25
![](/Images/OutliningIndicators/None.gif)
26
![](/Images/OutliningIndicators/None.gif)
27
![](/Images/OutliningIndicators/None.gif)
28
![](/Images/OutliningIndicators/None.gif)
29
![](/Images/OutliningIndicators/None.gif)
30
![](/Images/OutliningIndicators/None.gif)
31
![](/Images/OutliningIndicators/None.gif)
32
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
33
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
34
![](/Images/OutliningIndicators/None.gif)
35
![](/Images/OutliningIndicators/None.gif)
36
![](/Images/OutliningIndicators/None.gif)
37
![](/Images/OutliningIndicators/None.gif)
38
![](/Images/OutliningIndicators/None.gif)