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

📄 frmuser.vb

📁 基于VB.NET开发的简单的图书馆管理系统,可正常运行以测试,内带源码.
💻 VB
📖 第 1 页 / 共 4 页
字号:
        Me.bnCancle.Size = New System.Drawing.Size(88, 24)
        Me.bnCancle.TabIndex = 160
        Me.bnCancle.Text = "清空"
        '
        'bnModify
        '
        Me.bnModify.Location = New System.Drawing.Point(390, 74)
        Me.bnModify.Name = "bnModify"
        Me.bnModify.Size = New System.Drawing.Size(88, 24)
        Me.bnModify.TabIndex = 159
        Me.bnModify.Text = "修改"
        '
        'tbStudNo
        '
        Me.tbStudNo.Location = New System.Drawing.Point(198, 238)
        Me.tbStudNo.Name = "tbStudNo"
        Me.tbStudNo.Size = New System.Drawing.Size(152, 21)
        Me.tbStudNo.TabIndex = 158
        Me.tbStudNo.Text = ""
        '
        'tbClass
        '
        Me.tbClass.Location = New System.Drawing.Point(198, 208)
        Me.tbClass.Name = "tbClass"
        Me.tbClass.Size = New System.Drawing.Size(152, 21)
        Me.tbClass.TabIndex = 157
        Me.tbClass.Text = ""
        '
        'tbEmail
        '
        Me.tbEmail.Location = New System.Drawing.Point(198, 268)
        Me.tbEmail.Name = "tbEmail"
        Me.tbEmail.Size = New System.Drawing.Size(152, 21)
        Me.tbEmail.TabIndex = 156
        Me.tbEmail.Text = ""
        '
        'tbusername
        '
        Me.tbusername.Location = New System.Drawing.Point(198, 148)
        Me.tbusername.Name = "tbusername"
        Me.tbusername.Size = New System.Drawing.Size(152, 21)
        Me.tbusername.TabIndex = 155
        Me.tbusername.Text = ""
        '
        'tbPwdConfirm
        '
        Me.tbPwdConfirm.Location = New System.Drawing.Point(198, 118)
        Me.tbPwdConfirm.Name = "tbPwdConfirm"
        Me.tbPwdConfirm.Size = New System.Drawing.Size(152, 21)
        Me.tbPwdConfirm.TabIndex = 154
        Me.tbPwdConfirm.Text = ""
        '
        'tbPwd
        '
        Me.tbPwd.Location = New System.Drawing.Point(198, 88)
        Me.tbPwd.Name = "tbPwd"
        Me.tbPwd.Size = New System.Drawing.Size(152, 21)
        Me.tbPwd.TabIndex = 153
        Me.tbPwd.Text = ""
        '
        'tbloginname
        '
        Me.tbloginname.Location = New System.Drawing.Point(198, 58)
        Me.tbloginname.Name = "tbloginname"
        Me.tbloginname.ReadOnly = True
        Me.tbloginname.Size = New System.Drawing.Size(152, 21)
        Me.tbloginname.TabIndex = 161
        Me.tbloginname.Text = ""
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(138, 251)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(56, 24)
        Me.Label7.TabIndex = 152
        Me.Label7.Text = "学号:"
        Me.Label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(122, 114)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(72, 24)
        Me.Label6.TabIndex = 151
        Me.Label6.Text = "确认口令:"
        Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(138, 146)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(56, 24)
        Me.Label5.TabIndex = 150
        Me.Label5.Text = "姓名:"
        Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(138, 283)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(56, 24)
        Me.Label4.TabIndex = 149
        Me.Label4.Text = "email:"
        Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(138, 219)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(56, 24)
        Me.Label3.TabIndex = 148
        Me.Label3.Text = "班级:"
        Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(138, 90)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(56, 24)
        Me.Label2.TabIndex = 147
        Me.Label2.Text = "口令:"
        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label8
        '
        Me.Label8.Location = New System.Drawing.Point(122, 58)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(72, 24)
        Me.Label8.TabIndex = 146
        Me.Label8.Text = "借阅证号:"
        Me.Label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'GroupBox1
        '
        Me.GroupBox1.Location = New System.Drawing.Point(120, 32)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(256, 304)
        Me.GroupBox1.TabIndex = 162
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "修改用户资料"
        '
        'TabControl1
        '
        Me.TabControl1.Controls.Add(Me.tabborrow)
        Me.TabControl1.Controls.Add(Me.tabcborrow)
        Me.TabControl1.Controls.Add(Me.tabreturn)
        Me.TabControl1.Controls.Add(Me.tabquery)
        Me.TabControl1.Controls.Add(Me.TabPage6)
        Me.TabControl1.ItemSize = New System.Drawing.Size(48, 17)
        Me.TabControl1.Location = New System.Drawing.Point(0, 16)
        Me.TabControl1.Name = "TabControl1"
        Me.TabControl1.SelectedIndex = 0
        Me.TabControl1.Size = New System.Drawing.Size(600, 400)
        Me.TabControl1.TabIndex = 0
        '
        'frmuser
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(600, 485)
        Me.Controls.Add(Me.stabmain)
        Me.Controls.Add(Me.TabControl1)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "frmuser"
        Me.Text = "图书管理系统----用户"
        CType(Me.stabusername, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.stauserquanxian, System.ComponentModel.ISupportInitialize).EndInit()
        Me.tabborrow.ResumeLayout(False)
        CType(Me.dgRst, System.ComponentModel.ISupportInitialize).EndInit()
        Me.tabreturn.ResumeLayout(False)
        CType(Me.dg2, System.ComponentModel.ISupportInitialize).EndInit()
        Me.tabquery.ResumeLayout(False)
        CType(Me.dgrstquery, System.ComponentModel.ISupportInitialize).EndInit()
        Me.tabcborrow.ResumeLayout(False)
        CType(Me.dg1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.TabPage6.ResumeLayout(False)
        Me.TabControl1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Public loginname As String
    Public strSource As String = "workstation id=郭洪博;packet size=4096;integrated security=SSPI;initial catalog=books;persist security info=False"



    Private Sub frmuser_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        showuserinfo()
        stabusername.Text = "当前登录用户为:" + loginname
        stauserquanxian.Text = "当前登录用户权限为:----借阅用户"
    End Sub
    
    Private Sub showuserinfo()
        Dim strSelect As String = "select * from bookcard where cardid= '" + loginname + "'"
        Dim conn As SqlConnection = New SqlConnection(strSource)
        conn.Open()
        Dim cmd As SqlCommand = New SqlCommand(strSelect, conn)
        Dim dr As SqlDataReader = cmd.ExecuteReader()

        If Not dr.HasRows Then
            conn.Close()
            Exit Sub
        End If
        dr.Read()

        tbloginname.Text = loginname
        tbPwd.Text = dr.Item("password").ToString().Trim()
        tbPwdConfirm.Text = dr.Item("password").ToString().Trim()
        tbusername.Text = dr.Item("name").ToString().Trim()
        tbsex.Text = dr.Item("sex").ToString().Trim()
        tbClass.Text = dr.Item("class").ToString().Trim()
        tbStudNo.Text = dr.Item("sno").ToString().Trim()
        tbEmail.Text = dr.Item("email").ToString().Trim()
        tbtelno.Text = dr.Item("telno").ToString().Trim()

        conn.Close()
    End Sub
    Private Sub bnH_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnH.Click
        Dim strCmd As String = "select avacount from books where bookid = '" + tbhsbookid.Text.Trim() + "'"
        Dim conn As SqlConnection = New SqlConnection(strSource)
        conn.Open()
        Dim cmd As SqlCommand = New SqlCommand(strCmd, conn)
        Dim reader As SqlDataReader = cmd.ExecuteReader()
        If Not reader.HasRows Then
            'fdsafdsa
            conn.Close()
            Exit Sub
        End If

        reader.Read()
        Dim nava As Integer = Convert.ToInt32(reader.Item("avacount").ToString().Trim())
        nava += 1
        reader.Close()

        strCmd = "delete from borrowinfo where cardid ='" + loginname + "' and bookid = '" + tbhsbookid.Text.Trim() + "'"
        cmd.CommandText = strCmd
        Try
            cmd.ExecuteNonQuery()
            strCmd = "update books set avacount =" + nava.ToString + " where bookid = '" + tbhsbookid.Text.Trim() + "'"
            cmd.CommandText = strCmd
            cmd.ExecuteNonQuery()
            MessageBox.Show("还书成功!")
        Catch ex As Exception
            MessageBox.Show(ex.ToString + "还书失败!")
        End Try


        conn.Close()
    End Sub


    Private Sub bnXj_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnXj.Click
        Dim strSelect As String = "select btime,rtime,recount from borrowinfo where bookid = " + tbxjbookid.Text.Trim() + ""
        Dim conn As SqlConnection = New SqlConnection(strSource)
        conn.Open()
        Dim cmd As SqlCommand = New SqlCommand(strSelect, conn)
        Dim reader As SqlDataReader = cmd.ExecuteReader()
        If Not reader.HasRows Then
            MessageBox.Show("bookid 错误!")
            conn.Close()
            Exit Sub
        End If

        reader.Read()
        Dim strbtime As Date = reader.Item("btime").ToString().Trim()
        Dim strrtime As Date = reader.Item("rtime").ToString().Trim()
        Dim counter As Integer
        Try
            counter = reader.Item("recount")

        Catch ex As Exception
            counter = 0

        End Try
       
        '判断是否可以续借

        If counter >= 2 Then
            MessageBox.Show("不能续借!")
            conn.Close()
            Exit Sub
        End If
        reader.Close()

        '续借操作
        Try
            counter += 1

⌨️ 快捷键说明

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