📄 管理工资信息.aspx.vb
字号:
Imports System
Imports System.Data
Imports System.Data.OleDb
Imports salory
Imports lianjie1
Partial Class Default2
Inherits System.Web.UI.Page
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim cnn As salory1 = New salory1()
Me.GridView2.DataSource = cnn.salory(Me.DropDownList1.SelectedValue)
Me.GridView2.DataBind()
Me.GridView2.Visible = True
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cnn As salory1 = New salory1()
Dim yno As String = Me.TextBox1.Text
Dim yname As String = Me.TextBox2.Text
Dim dx As String = Me.TextBox3.Text
Dim bt As String = Me.TextBox4.Text
Dim jj As String = Me.TextBox5.Text
Dim jbf As String = Me.TextBox6.Text
Dim gz As String = Me.TextBox7.Text
Dim insert As salory1 = New salory1()
Dim cn As lianjie = New lianjie()
Dim filepath As String = cn.lianjie
Dim con As OleDbConnection = New OleDbConnection(filepath)
con.Open()
Dim cmd As OleDbCommand = New OleDbCommand("select * from 员工工资信息表 where 员工号='" & yno & "'", con)
Dim reader As OleDbDataReader = cmd.ExecuteReader
If reader.Read = True Then
Me.Label1.Visible = True
Me.Label1.Text = "用户名已经存在"
Me.TextBox1.Text = ""
Me.TextBox1.Focus()
Else
If insert.insert(yno, yname, dx, bt, jj, jbf, gz) = True Then
Me.Label1.Visible = True
Me.Label1.Text = "信息已经提交!"
Me.GridView1.DataBind()
Me.GridView1.Visible = True
Me.DropDownList1.DataBind()
Me.DropDownList2.DataBind()
Me.DropDownList3.DataBind()
End If
con.Close()
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.GridView1.Visible = True
End Sub
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim cnn As salory1 = New salory1()
Dim yno As String = Trim(Me.TextBox1.Text)
Dim yname As String = Trim(Me.TextBox2.Text)
Dim dx As String = Trim(Me.TextBox3.Text)
Dim bt As String = Trim(Me.TextBox4.Text)
Dim jj As String = Trim(Me.TextBox5.Text)
Dim jbf As String = Trim(Me.TextBox6.Text)
Dim gz As String = Trim(Me.TextBox7.Text)
If cnn.update(yno, yname, dx, bt, jj, jbf, gz) = True Then
Me.Label2.Visible = True
Me.Label2.Text = "更新成功!"
Me.GridView1.DataBind()
Me.GridView1.Visible = True
Me.DropDownList3.DataBind()
Me.DropDownList2.DataBind()
Me.DropDownList1.DataBind()
Else
Me.Label2.Visible = True
Me.Label2.Text = "更新失败,请重新尝试。"
End If
End Sub
Protected Sub DropDownList2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList2.SelectedIndexChanged
Dim yno As String = Me.DropDownList2.SelectedValue.ToString
Dim cn As lianjie = New lianjie()
Dim filepath As String = cn.lianjie
Dim cnn As OleDbConnection = New OleDbConnection(filepath)
cnn.Open()
Dim cmd As OleDbCommand = New OleDbCommand("select * from 员工工资信息表 where 员工号='" & yno & "'", cnn)
Dim reader As OleDbDataReader = cmd.ExecuteReader()
If reader.Read Then
Me.TextBox1.Text = reader(0).ToString
Me.TextBox2.Text = reader(1).ToString
Me.TextBox3.Text = reader(2).ToString
Me.TextBox4.Text = reader(3).ToString
Me.TextBox5.Text = reader(4).ToString
Me.TextBox6.Text = reader(5).ToString
Me.TextBox7.Text = reader(6).ToString
End If
End Sub
Protected Sub DropDownList3_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList3.SelectedIndexChanged
Dim yno As String = Me.DropDownList3.SelectedValue.ToString
Dim cn As lianjie = New lianjie()
Dim filepath As String = cn.lianjie
Dim cnn As OleDbConnection = New OleDbConnection(filepath)
cnn.Open()
Dim cmd As OleDbCommand = New OleDbCommand("select * from 员工工资信息表 where 员工号='" & yno & "'", cnn)
Dim reader As OleDbDataReader = cmd.ExecuteReader()
If reader.Read Then
Me.TextBox1.Text = reader(0).ToString
Me.TextBox2.Text = reader(1).ToString
Me.TextBox3.Text = reader(2).ToString
Me.TextBox4.Text = reader(3).ToString
Me.TextBox5.Text = reader(4).ToString
Me.TextBox6.Text = reader(5).ToString
Me.TextBox7.Text = reader(6).ToString
End If
End Sub
Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim cnn As salory1 = New salory1()
Dim yno As String = Trim(Me.TextBox1.Text)
Dim yname As String = Trim(Me.TextBox2.Text)
Dim dx As String = Trim(Me.TextBox3.Text)
Dim bt As String = Trim(Me.TextBox4.Text)
Dim jj As String = Trim(Me.TextBox5.Text)
Dim jbf As String = Trim(Me.TextBox6.Text)
Dim gz As String = Trim(Me.TextBox7.Text)
If cnn.delete(yno, yname, dx, bt, jj, jbf, gz) = True Then
Me.Label2.Visible = True
Me.Label2.Text = "删除成功!"
Me.GridView1.DataBind()
Me.GridView1.Visible = True
Me.DropDownList3.DataBind()
Me.DropDownList2.DataBind()
Me.DropDownList1.DataBind()
Else
Me.Label2.Visible = True
Me.Label2.Text = "删除失败。"
End If
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.TextBox1.Text = ""
Me.TextBox2.Text = ""
Me.TextBox3.Text = ""
Me.TextBox4.Text = ""
Me.TextBox5.Text = ""
Me.TextBox6.Text = ""
Me.TextBox7.Text = ""
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -