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

📄 login.aspx.vb

📁 基于.net科研管理信息系统 毕业设计参考代码
💻 VB
字号:
Imports System.Data
Imports System.Data.SqlClient
Partial Class WebForm4
    Inherits System.Web.UI.Page
    Private connectionstring As String
    Dim conn As SqlConnection



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

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

    End Sub

    '注意: 以下占位符声明是 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
        '在此处放置初始化页的用户代码
        conn = New SqlConnection(connectionstring)
        conn.ConnectionString = "server=HP-PC;Database=SRM;uid=sa;pwd=sa;"
    End Sub

    Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit1.ServerClick

        Dim ds As DataSet = New DataSet
        Dim da As SqlDataAdapter = New SqlDataAdapter("select * from sci_user where user_id='" + uid.Value + "' and password='" + pwd.Value + "'and role='3'", conn)
        conn.Open()
        da.Fill(ds)

        If uid.Value = "" Then
            Response.Write("<script>alert('请输入用户名!');</script>")
        ElseIf pwd.Value = "" Then
            Response.Write("<script>alert('请输入密码!');</script>")
        ElseIf ds.Tables(0).Rows.Count = 0 Then

            Response.Write("<script>alert('不存在此用户,请及时注册!');</script>")

        Else
            Session("user_id") = uid.Value
            Response.Redirect("index.aspx")

        End If
        conn.Close()
        ds.Clear()
        ds = Nothing

    End Sub

    Private Sub Reset1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Reset1.ServerClick

    End Sub

    Private Sub Submit2_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit2.ServerClick
        Response.Redirect("register.aspx")
    End Sub
End Class

⌨️ 快捷键说明

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