LoggedIn.aspx.vb
上传用户:bhp852
上传日期:2022-07-12
资源大小:22k
文件大小:4k
- Imports System.Data
- Imports System.Data.OleDb
- Partial Class suc
- Inherits System.Web.UI.Page
- Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
- If Session("user") = "" Then
- Response.Redirect("Default.aspx")
- End If
- End Sub
- Protected Sub Button7_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button7.Click
- MsgBox("帐户已删除,将返回登录界面!")
- Dim StrCnn As String
- Dim StrSql As String
- Dim Cnn As OleDbConnection
- Dim Cmd As OleDbCommand
- StrCnn = "Provider= Microsoft.Jet.Oledb.4.0;Data Source=" + Server.MapPath("User.DMB.mdb") '连接字串
- StrSql = "delete from usersheet where LoginName = '" + Session("user") + "'" '删除字串
- Cnn = New OleDbConnection(StrCnn) '连接数据库
- Cnn.Open()
- Cmd = New OleDbCommand(StrSql, Cnn) '删除当前用户数据
- Cmd.ExecuteNonQuery()
- Cnn.Close()
- Response.Redirect("Default.aspx") '返回登录页面
- End Sub
- Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
- Panel1.Visible = False
- Panel2.Visible = True
- Panel6.Visible = False
- Panel7.Visible = False
- End Sub
- Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
- 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 = '" + Session("user") + "' and userpass = '" + TextBox1.Text.ToString + "'" '使用用户输入的原密码和当前用户名查找
- Cnn = New OleDbConnection(StrCnn) '连接数据库
- Cnn.Open()
- Cmd = New OleDbCommand(StrSql, Cnn)
- Dr = Cmd.ExecuteReader()
- If (Dr.Read()) And TextBox2.Text.ToString = TextBox3.Text.ToString Then '当用户输入的原密码正确且新密码相匹配时写入
- StrSql = "update usersheet SET UserPass = '" + TextBox2.Text.ToString + "'where LoginName = '" + Session("user") + "'" '更新数据库字串
- Cnn.Close()
- Cnn = New OleDbConnection(StrCnn)
- Cnn.Open()
- Cmd = New OleDbCommand(StrSql, Cnn)
- Cmd.ExecuteNonQuery()
- Cnn.Close()
- Panel1.Visible = False
- Panel2.Visible = False
- Panel6.Visible = True
- Panel7.Visible = False
- Else '原密码输入错误时显示错误提示
- Label7.Visible = True
- Cnn.Close()
- End If
- End Sub
- Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click, Button6.Click
- Response.Redirect("LoggedIn.aspx")
- End Sub
- Protected Sub Button4_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
- Session("user") = "" '清除session对象
- Session.Abandon()
- Response.Redirect("Default.aspx") '返回登录页面
- End Sub
- Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
- Panel1.Visible = False
- Panel2.Visible = False
- Panel6.Visible = False
- Panel7.Visible = True
- End Sub
- End Class