⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webform3.txt

📁 一个DQLSERVER设计的社团管理系统
💻 TXT
字号:
Imports System.Data
Imports System.Data.SqlClient
Public Class WebForm3
    Inherits System.Web.UI.Page

#Region " Web 窗体设计器生成的代码 "

    '该调用是 Web 窗体设计器所必需的。
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    Protected WithEvents Label2 As System.Web.UI.WebControls.Label
    Protected WithEvents Label3 As System.Web.UI.WebControls.Label
    Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
    Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
    Protected WithEvents Button1 As System.Web.UI.WebControls.Button
    Protected WithEvents Button2 As System.Web.UI.WebControls.Button
    Protected WithEvents Button3 As System.Web.UI.WebControls.Button
    Protected WithEvents Button4 As System.Web.UI.WebControls.Button
    Protected WithEvents TextBox3 As System.Web.UI.WebControls.TextBox
    Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
    Protected WithEvents Label4 As System.Web.UI.WebControls.Label
    Protected WithEvents Button5 As System.Web.UI.WebControls.Button
    Protected WithEvents Button6 As System.Web.UI.WebControls.Button
    Protected WithEvents Label5 As System.Web.UI.WebControls.Label
    Protected WithEvents Button7 As System.Web.UI.WebControls.Button

    '注意: 以下占位符声明是 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
        '在此处放置初始化页的用户代码
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim a As String
        Try
            Dim conn As New SqlConnection("Server=(local);Database=shiyan;Uid=sa;pwd=jkx2004")
            Dim cmd As New SqlCommand("select * from dhl_mg where hyno='" + TextBox1.Text + "'", conn)
            conn.Open()
            Dim dr As SqlDataReader = cmd.ExecuteReader()
            dr.Read()

            a = dr.GetValue(1)
            If TextBox2.Text.Trim.ToString = a.Trim.ToString Then
                Label4.Text = "登陆成功"
            Else
                Label4.Text = "登录不成功"
            End If
            If Label4.Text = "登陆成功" Then
                Button3.Enabled = True
            Else
                Button3.Enabled = False
            End If
            If Label4.Text = "登陆成功" Then
                Button4.Enabled = True
            Else
                Button4.Enabled = False
            End If
            If Label4.Text = "登陆成功" Then
                Button5.Enabled = True
            Else
                Button5.Enabled = False
            End If
            If Label4.Text = "登陆成功" Then
                Button6.Enabled = True
            Else
                Button6.Enabled = False
            End If

        Catch ee As Exception
            Label4.Text = "管理员登录失败"
        End Try
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Try
            Dim conn As New SqlConnection("Server=(local);Database=shiyan;Uid=sa;pwd=jkx2004")
            Dim cmd As New SqlCommand("select * from dhl_hy ", conn)
            conn.Open()
            Dim dr As SqlDataReader = cmd.ExecuteReader()         '建立DataReader对象
            DataGrid1.DataSource = dr                           '指定数据源
            DataGrid1.DataBind()                               '执行绑定:显示内容
            conn.Close()
        Catch ee As Exception
            Label5.Text = "没有数据"
        End Try
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Try
            Dim conn As New SqlConnection("Server=(local);Database=shiyan;Uid=sa;pwd=jkx2004")
            Dim cmd As New SqlCommand("select * from dhl_hy where 学号='" + TextBox3.Text + "' ", conn)
            conn.Open()
            Dim dr As SqlDataReader = cmd.ExecuteReader()         '建立DataReader对象
            DataGrid1.DataSource = dr                           '指定数据源
            DataGrid1.DataBind()                               '执行绑定:显示内容
            conn.Close()
        Catch ee As Exception
            Label5.Text = "没有数据"
        End Try
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Try
            Dim conn As New SqlConnection("Server=(local);Database=shiyan;Uid=sa;pwd=jkx2004")
            Dim cmd As New SqlCommand("delete from dhl_hy where 学号='" + TextBox3.Text + "'", conn)
            conn.Open()
            Dim dr As SqlDataReader = cmd.ExecuteReader()         '建立DataReader对象
            DataGrid1.DataSource = dr                           '指定数据源
            DataGrid1.DataBind()                               '执行绑定:显示内容
            conn.Close()
        Catch ee As Exception
            Label5.Text = "没有数据"
        End Try
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Try
            Dim conn As New SqlConnection("Server=(local);Database=shiyan;Uid=sa;pwd=jkx2004")
            Dim cmd As New SqlCommand("delete from dhl_hy ", conn)
            conn.Open()
            Dim dr As SqlDataReader = cmd.ExecuteReader()         '建立DataReader对象
            DataGrid1.DataSource = dr                           '指定数据源
            DataGrid1.DataBind()                               '执行绑定:显示内容
            conn.Close()
            Catch ee As Exception
            Label5.Text = "没有数据"
        End Try
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Response.Redirect("webform3.aspx")
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Response.Redirect("webform1.aspx")
    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -