frm_editreader.vb

来自「是关于图书管理系统的用vb.net 和access开发的」· VB 代码 · 共 49 行

VB
49 行
字号
Imports System.Data.OleDb
Public Class frm_EditReader


    Dim myConnection As New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; Data source=D:\library.mdb")
    Dim myCommand As OleDbCommand
    Dim myReader As OleDbDataReader

    Private Sub frm_EditUser_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'LibraryDataSet.SystemUsers' table. You can move, or remove it, as needed.
        Me.SystemUsersTableAdapter.Fill(Me.LibraryDataSet.SystemUsers)

    End Sub

    Private Sub exitbt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitbt.Click
        Me.Close()
    End Sub

    Private Sub savebt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles savebt.Click
        If UserNameTextBox.Text = "" Then
            displayMsg("Must enter name!")
            Exit Sub
        End If

        If PasswordTextBox.Text = "" Then
            displayMsg("Must enter password!")
            Exit Sub
        End If

        myConnection.Open()

        myCommand = New OleDbCommand("UPDATE Backup SET username='" & UserNameTextBox.Text & "',[password]= '" & _
        PasswordTextBox.Text & "' ,Status = '" & StatusTextBox.Text & "' ,Address = '" & AddressTextBox.Text & _
        "' ,Phone = '" & PhoneTextBox.Text & "' ,CellPhone = '" & CellPhoneTextBox.Text & "' ,Email = '" & EmailTextBox.Text & _
        "' ,AdminRights = '" & ComboBox1.Text & "' ,LibRights = '" & ComboBox2.Text & "' ,ReaderRights = '" & ComboBox3.Text & "' ", myConnection)

        Try
            MyCommand.ExecuteNonQuery()
        Catch c As Exception
            MsgBox(c.ToString)
        End Try
        MyConnection.Close()
        MyCommand.Dispose()
    End Sub
    Sub displayMsg(ByVal msg As String)
        MsgBox(msg, MsgBoxStyle.Information, "libarary management system")

    End Sub
End Class

⌨️ 快捷键说明

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