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

📄 frm_gongzi_edit.frm

📁 前两年帮人写的毕业设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Frm_gongzi_edit 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "工资信息修改"
   ClientHeight    =   3330
   ClientLeft      =   4725
   ClientTop       =   3210
   ClientWidth     =   3210
   Icon            =   "Frm_gongzi_edit.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3330
   ScaleWidth      =   3210
   StartUpPosition =   1  '所有者中心
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   1260
      TabIndex        =   6
      Top             =   120
      Width           =   1695
   End
   Begin VB.TextBox Text1 
      Height          =   300
      Left            =   1260
      TabIndex        =   5
      Top             =   960
      Width           =   1695
   End
   Begin VB.TextBox Text2 
      Height          =   300
      Left            =   1260
      TabIndex        =   4
      Top             =   1380
      Width           =   1695
   End
   Begin VB.TextBox Text3 
      Height          =   300
      Left            =   1260
      TabIndex        =   3
      Top             =   1800
      Width           =   1695
   End
   Begin VB.TextBox Text4 
      Height          =   300
      Left            =   1260
      TabIndex        =   2
      Top             =   2220
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   300
      TabIndex        =   1
      Top             =   2760
      Width           =   1035
   End
   Begin VB.CommandButton Command2 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   375
      Left            =   1860
      TabIndex        =   0
      Top             =   2760
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "职工号"
      Height          =   195
      Left            =   300
      TabIndex        =   13
      Top             =   180
      Width           =   675
   End
   Begin VB.Label Label2 
      Caption         =   "姓 名"
      Height          =   195
      Left            =   300
      TabIndex        =   12
      Top             =   600
      Width           =   615
   End
   Begin VB.Label Label3 
      BackColor       =   &H80000009&
      BorderStyle     =   1  'Fixed Single
      Height          =   300
      Left            =   1260
      TabIndex        =   11
      Top             =   540
      Width           =   1695
   End
   Begin VB.Label Label4 
      Caption         =   "基本工资"
      Height          =   255
      Left            =   300
      TabIndex        =   10
      Top             =   1020
      Width           =   735
   End
   Begin VB.Label Label5 
      Caption         =   "技能工资"
      Height          =   195
      Left            =   300
      TabIndex        =   9
      Top             =   1440
      Width           =   795
   End
   Begin VB.Label Label6 
      Caption         =   "奖 金"
      Height          =   255
      Left            =   300
      TabIndex        =   8
      Top             =   1800
      Width           =   555
   End
   Begin VB.Label Label7 
      Caption         =   "扣 款"
      Height          =   315
      Left            =   300
      TabIndex        =   7
      Top             =   2220
      Width           =   555
   End
End
Attribute VB_Name = "Frm_gongzi_edit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Private Sub Combo1_Click()
    Dim cn As ADODB.Connection
    Dim rst As New ADODB.Recordset
    Set cn = GetCn
    rst.Open "select xm from zhigong where zgh='" & Combo1 & "'", cn, 0, 1
    If rst.BOF And rst.EOF Then
        MsgBox "职工号错误!", vbExclamation, "提示"
        rst.Close
        cn.Close
        Exit Sub
    End If
    Label3.Caption = rst(0)
End Sub

Private Sub Combo1_LostFocus()
    Dim cn As ADODB.Connection
    Dim rst As New ADODB.Recordset
    Set cn = GetCn
    rst.Open "select xm from zhigong where zgh='" & Combo1 & "'", cn, 0, 1
    If rst.BOF And rst.EOF Then
        MsgBox "职工号错误!", vbExclamation, "提示"
        rst.Close
        cn.Close
        Exit Sub
    End If
    Label3.Caption = rst(0)
End Sub

Private Sub Command1_Click()
    On Error GoTo myerr
    Dim cn As ADODB.Connection
    msg = MsgBox("是否修改?", vbYesNo + vbQuestion, "提示")
    If msg = vbNo Then Exit Sub
    If Not (IsNumeric(Text1) And IsNumeric(Text2) And IsNumeric(Text3) And IsNumeric(Text4)) Then
        MsgBox "请正确输入数值!", vbExclamation, "提示"
        Exit Sub
    End If
    Set cn = GetCn
    cn.Execute "update gongzi set zgh='" & Combo1 & "',xm='" & Label3.Caption & "',jb=" & Text1 & ",jn=" & Text2 & ",jj=" & Text3 & ",kk=" & Text4 & ",sf=" & Val(Text1) + Val(Text2) + Val(Text3) - Val(Text4) & " where id=" & Frm_gongzi.ListView1.SelectedItem.SubItems(7)
    
    Frm_gongzi.ListView1.SelectedItem.Text = Combo1
    Frm_gongzi.ListView1.SelectedItem.SubItems(1) = Label3.Caption
    Frm_gongzi.ListView1.SelectedItem.SubItems(2) = Text1
    Frm_gongzi.ListView1.SelectedItem.SubItems(3) = Text2
    Frm_gongzi.ListView1.SelectedItem.SubItems(4) = Text3
    Frm_gongzi.ListView1.SelectedItem.SubItems(5) = Text4
    Frm_gongzi.ListView1.SelectedItem.SubItems(6) = Val(Text1) + Val(Text2) + Val(Text3) - Val(Text4)
    
    MsgBox "已成功保存!", vbExclamation, "提示"
    Exit Sub
myerr:
    MsgBox Error, vbExclamation, "提示"
    
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    On Error GoTo myerr
    Dim cn As ADODB.Connection
    Dim rst As New ADODB.Recordset
    Set cn = GetCn
    rst.Open "select zgh from zhigong order by 1", cn, 0, 1
    Combo1.Clear
    Do While Not rst.EOF
        Combo1.AddItem rst(0)
        rst.MoveNext
    Loop
    rst.Close
    cn.Close
    
    Combo1 = Frm_gongzi.ListView1.SelectedItem.Text
    Label3.Caption = Frm_gongzi.ListView1.SelectedItem.SubItems(1)
    Text1 = Frm_gongzi.ListView1.SelectedItem.SubItems(2)
    Text2 = Frm_gongzi.ListView1.SelectedItem.SubItems(3)
    Text3 = Frm_gongzi.ListView1.SelectedItem.SubItems(4)
    Text4 = Frm_gongzi.ListView1.SelectedItem.SubItems(5)
    Exit Sub
myerr:
    Select Case Err
        Case -2147217904
            If rst.State = 1 Then rst.Close
            rst.Open "select count(*) from zhigong", cn, 0, 1
            If rst(0) = 0 Then
                Exit Sub
            Else
                MsgBox Error, vbExclamation, "提示"
            End If
        Case Else
            MsgBox Error, vbExclamation, "提示"
    End Select
End Sub


⌨️ 快捷键说明

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