📄 全部代码.txt
字号:
Imports System.Data.SqlClient
'borrec.aspx.vb
'本代码室borrec.aspx
'本窗体用来显示当前登陆读者的所有借书记录,包括还过的书和没有还过的书
'数学00-2班 翟靖轩 编写
'2004-5-20
Public Class borrec
Inherits System.Web.UI.Page
Dim CnNO As Int32
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents dbgborrowlist As System.Web.UI.WebControls.DataGrid
'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Property countNo() As Int32
Set(ByVal value As Int32)
CnNO = value
End Set
Get
Return CnNO
End Get
End Property
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
If Session("UID") Is Nothing Then
Page.Response.Redirect("login.aspx")
Else
If Not IsPostBack Then
mydatabind(Session("UID"))
End If
End If
End Sub
Function mydatabind(ByVal strAu_id As String)
Dim cnlib2004 As SqlConnection
Dim cmdAuBorrowList As SqlCommand
Dim dr As SqlDataReader
cnlib2004 = New SqlConnection(ConfigurationSettings.AppSettings("cncstr"))
cmdAuBorrowList = New SqlCommand
With cmdAuBorrowList
.CommandType = CommandType.StoredProcedure
.CommandText = "SelectAuAllBorrowList"
.Connection = cnlib2004
End With
Dim mAu_id As New SqlParameter("@Au_id", SqlDbType.NVarChar, 50) '1
cmdAuBorrowList.Parameters.Add(mAu_id)
mAu_id.Value = strAu_id
Try
cnlib2004.Open()
dr = cmdAuBorrowList.ExecuteReader
Me.dbgborrowlist.DataSource = dr
'Me.dbgborrowlist.DataBind()
' Me.countNo = Me.dbgborrowlist.Items.Count
Me.DataBind()
Catch ex As Exception
Response.Redirect("error.aspx?errmsg=" + ex.Message)
Finally
cnlib2004.Close()
End Try
End Function
End Class
Imports System.Data.SqlClient
Public Class CCheckLog
Private Uid As String
Private pwd As String
Public Sub New(ByVal U_id As String, ByVal P_wd As String)
Me.Uid = U_id
Me.pwd = P_wd
End Sub
Public Function IsLogSuc() As Boolean
If Uid Is Nothing Then
Return False
Else
Dim cn As New SqlConnection(ConfigurationSettings.AppSettings("cncstr"))
Dim cmd As New SqlCommand
Dim Islog As Int16 = 0
With cmd
.CommandType = CommandType.StoredProcedure
.CommandText = "SelectAuPwd"
.Connection = cn
End With
Dim mAu_id As New SqlParameter("@Au_id", SqlDbType.NVarChar)
Dim mAu_password As New SqlParameter("@Au_password", SqlDbType.NVarChar)
With cmd.Parameters
.Add(mAu_id)
.Add(mAu_password)
End With
mAu_id.Value = Uid
mAu_password.Value = pwd
Try
cn.Open()
Islog = cmd.ExecuteScalar
If Islog = 1 Then
Return True
Else
Return False
End If
Catch ex As Exception
'Return False
Throw ex
Finally
cn.Close()
If Not cn Is Nothing Then
cn.Dispose()
End If
End Try
End If
End Function
End Class
Imports System.Data.SqlClient
Public Class curborr
Inherits System.Web.UI.Page
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents dbgborrowlist As System.Web.UI.WebControls.DataGrid
'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
If Session("UID") Is Nothing Then
Page.Response.Redirect("login.aspx")
Else
If Not IsPostBack Then
mydatabind(Session("UID"))
End If
End If
End Sub
Function mydatabind(ByVal strAu_id As String)
Dim cnlib2004 As SqlConnection
Dim cmdAuBorrowList As SqlCommand
Dim dr As SqlDataReader
cnlib2004 = New SqlConnection(ConfigurationSettings.AppSettings("cncstr"))
cmdAuBorrowList = New SqlCommand
With cmdAuBorrowList
.CommandType = CommandType.StoredProcedure
'.CommandText = "SelectAuBorrowListWeb"
.CommandText = "SelectAuBorrowList"
.Connection = cnlib2004
End With
Dim mAu_id As New SqlParameter("@Au_id", SqlDbType.NVarChar, 50) '1
cmdAuBorrowList.Parameters.Add(mAu_id)
mAu_id.Value = strAu_id
Try
cnlib2004.Open()
dr = cmdAuBorrowList.ExecuteReader
Me.dbgborrowlist.DataSource = dr
Me.dbgborrowlist.DataBind()
Catch ex As Exception
Response.Redirect("error.aspx?errmsg=" + ex.Message)
Finally
cnlib2004.Close()
End Try
End Function
End Class
'本页用来修改读者的email和密码
Imports System.Data.SqlClient
Public Class editinfo
Inherits System.Web.UI.Page
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
Protected WithEvents txtPwd1 As System.Web.UI.WebControls.TextBox
Protected WithEvents txtPwdE1 As System.Web.UI.WebControls.TextBox
Protected WithEvents txtPwdE2 As System.Web.UI.WebControls.TextBox
Protected WithEvents btnSubmit As System.Web.UI.WebControls.Button
Protected WithEvents txtEmail As System.Web.UI.WebControls.TextBox
Protected WithEvents btnEdit As System.Web.UI.WebControls.Button
Protected WithEvents RequiredFieldValidator1 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents RequiredFieldValidator2 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents CompareValidator1 As System.Web.UI.WebControls.CompareValidator
Protected WithEvents lblMsg As System.Web.UI.WebControls.Label
Protected WithEvents lblgengg As System.Web.UI.WebControls.Label
'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
If Session("UID") Is Nothing Then
Page.Response.Redirect("login.aspx")
Else
If Not IsPostBack Then
End If
End If
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
'服务端验证不用写
If Session("UID") Is Nothing Then
Page.Response.Redirect("login.aspx")
End If
Dim k As New CCheckLog(Session("UID"), Me.txtPwd1.Text)
If k.IsLogSuc = False Then
Me.lblMsg.Text = "密码错误!"
Me.lblMsg.Visible = True
Exit Sub
End If
Dim cn As New SqlConnection(ConfigurationSettings.AppSettings("cncstr"))
Dim cmd As New SqlCommand
With cmd
.CommandType = CommandType.StoredProcedure
.CommandText = "UpdateAuPwd"
.Connection = cn
End With
Dim mAu_id As New SqlParameter("@Au_id", SqlDbType.NVarChar)
Dim mAu_password As New SqlParameter("@Au_password", SqlDbType.NVarChar)
Dim mAu_Newpassword As New SqlParameter("@Au_Newpassword", SqlDbType.NVarChar)
With cmd.Parameters
.Add(mAu_id)
.Add(mAu_password)
.Add(mAu_Newpassword)
End With
mAu_id.Value = Session("UID")
mAu_password.Value = Me.txtPwd1.Text.Trim
mAu_Newpassword.Value = Me.txtPwdE1.Text.Trim
Try
cn.Open()
cmd.ExecuteNonQuery()
Me.lblMsg.Text = "更改成功!"
Me.lblMsg.Visible = True
Catch ex As Exception
Response.Redirect("error.aspx?errmsg=" + ex.Message)
Finally
cn.Close()
If Not cn Is Nothing Then
cn.Dispose()
End If
End Try
End Sub
Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
'服务端验证不用写
If Session("UID") Is Nothing Then
Page.Response.Redirect("login.aspx")
End If
Dim cn As New SqlConnection(ConfigurationSettings.AppSettings("cncstr"))
Dim cmd As New SqlCommand
With cmd
.CommandType = CommandType.StoredProcedure
.CommandText = "UpdateAuEmail"
.Connection = cn
End With
Dim mAu_id As New SqlParameter("@Au_id", SqlDbType.NVarChar)
Dim mAu_email As New SqlParameter("@Au_email", SqlDbType.NVarChar)
With cmd.Parameters
.Add(mAu_id)
.Add(mAu_email)
End With
mAu_id.Value = Session("UID")
mAu_email.Value = Me.txtEmail.Text.Trim
Try
cn.Open()
cmd.ExecuteNonQuery()
Me.lblgengg.Text = "更改成功!"
Me.lblgengg.Visible = True
Catch ex As Exception
Response.Redirect("error.aspx?errmsg=" + ex.Message)
Finally
cn.Close()
If Not cn Is Nothing Then
cn.Dispose()
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -