Default.aspx.vb
上传用户:bhp852
上传日期:2022-07-12
资源大小:22k
文件大小:1k
- Imports System.Data
- Imports System.Data.OleDb
- Partial Class _Default
- Inherits System.Web.UI.Page
- Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
- Dim StrCnn As String
- Dim StrSql As String
- Dim Cnn As OleDbConnection
- Dim Cmd As OleDbCommand
- Dim Dr As OleDbDataReader
- StrCnn = "Provider= Microsoft.Jet.Oledb.4.0;Data Source=" + Server.MapPath("User.DMB.mdb")
- StrSql = "select * from usersheet where LoginName = '" + Login1.UserName + "' and userpass = '" + Login1.Password + "'"
- Cnn = New OleDbConnection(StrCnn) '连接数据库
- Cnn.Open()
- Cmd = New OleDbCommand(StrSql, Cnn)
- Dr = Cmd.ExecuteReader()
- If (Dr.Read()) Then '判断当前用户输入的用户名密码是否与数据库中有匹配
- Session("user") = Login1.UserName
- Response.Redirect(Login1.DestinationPageUrl)
- End If
- End Sub
- End Class