login.aspx.vb
来自「数据库学习的绝好例子简单的数据库经典入门」· VB 代码 · 共 40 行
VB
40 行
Imports System.Data
Partial Class Login
Inherits System.Web.UI.Page
'Public variables
Public strErrorMessage As String = String.Empty
Protected Sub btnSubmit_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles btnSubmit.Click
'Initialize a new instance of the business logic component
Using objUsers As New WroxBusinessLogic.WBLUsers( _
"Wrox", "Time Tracker Oracle")
'Validate the user and get their role
Using objDataSet As DataSet = objUsers.ValidateLogin( _
txtLoginName.Text, txtPassword.Text)
If objDataSet.Tables("User").Rows.Count > 0 Then
If objDataSet.Tables("User").Rows(0).Item("Status") Then
Response.Redirect("TimeSheet.aspx?UserID=" & _
objDataSet.Tables("User").Rows(0).Item( _
"UserID").ToString & "&UserName=" & _
objDataSet.Tables("User").Rows(0).Item( _
"UserName").ToString)
Else
strErrorMessage = "Your account has been suspended." & _
ControlChars.CrLf & "Please contact your administrator."
End If
Else
strErrorMessage = "Your credentials were not validated."
End If
End Using
End Using
End Sub
End Class
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?