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

📄 userinfo.frm

📁 用microsoft vb6.0写的上班考勤系统!
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   375
         Left            =   720
         TabIndex        =   5
         Top             =   1020
         Width           =   975
      End
      Begin VB.Label Label2 
         BackColor       =   &H00C0C0C0&
         Caption         =   "姓名:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   375
         Left            =   720
         TabIndex        =   3
         Top             =   465
         Width           =   975
      End
   End
   Begin MSDataGridLib.DataGrid UserGrid 
      Height          =   4575
      Left            =   4200
      TabIndex        =   1
      Top             =   2520
      Width           =   7575
      _ExtentX        =   13361
      _ExtentY        =   8070
      _Version        =   393216
      BackColor       =   16777215
      HeadLines       =   1
      RowHeight       =   15
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin VB.Label Label1 
      BackColor       =   &H80000007&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "系统使用者资料"
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   42
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   975
      Left            =   2640
      TabIndex        =   0
      Top             =   240
      Width           =   6135
   End
End
Attribute VB_Name = "Userinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private RstUser As ADODB.Recordset
Private CnnUser As ADODB.Connection
Dim ModiInfo, DelInfo, Addinfo As Boolean

Private Sub BtnDel_Click()
  SelInfo.Visible = True
  Command1.Enabled = Faslse
  BtnModi.Enabled = False
  BtnDel.Enabled = False
  BtnSure.Enabled = True
  DelInfo = True
End Sub

Private Sub BtnExit_Click()
RstUser.Close
CnnUser.Close

Unload Me
End Sub

Private Sub btnModi_Click()
SelInfo.Visible = True
BtnSure.Enabled = True
Command1.Enabled = False
BtnDel.Enabled = False
ModiInfo = True

End Sub

Private Sub btnSure_Click()
  Command1.Enabled = True
  BtnModi.Enabled = True
  BtnDel.Enabled = True
  BtnSure.Enabled = False
  If DelInfo = True Then
    CnnUser.Execute "DELETE FROM userinfo   " _
                                    & "WHERE " _
                                    & "name='" + SelInfo.Text + "' " _
                                    & " "
    DelInfo = False
    Exit Sub
  End If
  
    If ModiInfo = True Then
      CnnUser.Execute "DELETE FROM userinfo   " _
                                    & "WHERE " _
                                    & "name='" + SelInfo.Text + "' " _
                                    & " "
       
      Set RstUser = New ADODB.Recordset
      RstUser.Open "select * from userinfo ", CnnUser, adOpenStatic, adLockBatchOptimistic, adCmdText
     
     
      RstUser.AddNew
        RstUser.Fields(0) = SelInfo.Text
        RstUser.Fields(1) = GongHao.Text
        RstUser.Fields(2) = rjriqi.Value
        RstUser.Fields(3) = jiwei.Text
        If NewPassWord.Text = Passwordtoo.Text Then
            RstUser.Fields(4) = NewPassWord.Text
        Else
            MsgBox "你输入的密码不一致!", vbOKOnly, "提醒!!!"
          Exit Sub
       End If
      RstUser.UpdateBatch
    End If
    
    If Addinfo = True Then
      Set RstUser = New ADODB.Recordset
      RstUser.Open "select * from userinfo where name='" + xingming.Text + "'", CnnUser, adOpenStatic, adLockBatchOptimistic, adCmdText
      If Not RstUser.EOF Then
        MsgBox "你输入的工作人员已存在!", vbOKOnly, "提醒!!"
        Exit Sub
      Else
        RstUser.AddNew
          RstUser.Fields(0) = xingming.Text
          RstUser.Fields(1) = GongHao.Text
          RstUser.Fields(2) = rjriqi.Value
          RstUser.Fields(3) = jiwei.Text
          If NewPassWord.Text = Passwordtoo.Text Then
            RstUser.Fields(4) = NewPassWord.Text
          Else
            MsgBox "你输入的密码不一致!", vbOKOnly, "提醒!!!"
          Exit Sub
          End If
  
        RstUser.UpdateBatch
        MsgBox "数据已保存!!", vbOKOnly, "提醒!!"
      End If
     End If
     Set RstUser = New ADODB.Recordset
     RstUser.CursorLocation = adUseClient
   'RstUser.Open "select Name as 姓名,Gonghao as 工号,riqi as 日期,Jiwei as 职位 from Userinfo", CnnUser, adOpenStatic, adLockOptimistic, adCmdText
   RstUser.Open "select name as 姓名,gonghao as 工号, riqi as 日期, JiWei as 职位,Mima as 密码 from userinfo", CnnUser, adOpenStatic, adLockBatchOptimistic, adCmdText
   Set UserGrid.DataSource = RstUser
   
   UserGrid.Columns(4).Width = 0
   UserGrid.Columns(1).Width = 500
End Sub

Private Sub Command1_Click()
BtnSure.Enabled = True
Command1.Enabled = False
BtnDel.Enabled = False
BtnModi.Enabled = Falsecga517422cga
Addinfo = True
SelInfo.Visible = False
End Sub

Private Sub Form_Load()
   Set CnnUser = New ADODB.Connection
   CnnUser.Open "kaoqin", "andy", "1234"
   
   Set RstUser = New ADODB.Recordset
   RstUser.CursorLocation = adUseClient
   'RstUser.Open "select Name as 姓名,Gonghao as 工号,riqi as 日期,Jiwei as 职位 from Userinfo", CnnUser, adOpenStatic, adLockOptimistic, adCmdText
   RstUser.Open "select name as 姓名,gonghao as 工号, riqi as 日期, JiWei as 职位,Mima as 密码 from userinfo", CnnUser, adOpenStatic, adLockBatchOptimistic, adCmdText
   Set UserGrid.DataSource = RstUser
   
   UserGrid.Columns(4).Width = 0
   UserGrid.Columns(1).Width = 500
   Do While Not RstUser.EOF
     SelInfo.AddItem RstUser.Fields(0)
     RstUser.MoveNext
   Loop
   'BtnSure.SetShape bsRoundRect
   'Command1.SetShape bsRoundRect
   'BtnExit.SetShape bsRoundRect
   'BtnModi.SetShape bsRoundRect
End Sub

Private Sub Gonghao_KeyUp(KeyCode As Integer, Shift As Integer)
   If KeyCode = 13 Or KeyCode = 40 Then
     jiwei.SetFocus
   End If
   
   If KeyCode = 38 Then
    xingming.SetFocus
   End If
End Sub

Private Sub Jiwei_Change()
If jiwei.Text = "1" Then
  jiwei.Text = "操作员"
End If

If jiwei.Text = " 2" Then
  jiwei.Text = "电脑技术员"
End If

If jiwei.Text = "3" Then
  jiwei.Text = "经理"
End If

If jiwei.Text = "4" Then
  jiwei.Text = "财务"
End If

If jiwei.Text = "5" Then
  jiwei.Text = "数据输入员"
End If

End Sub

Private Sub Jiwei_GotFocus()
StatusBar1.Panels(1).Text = "1、电脑操作员 2、技术员 3、经理 4、财务 5、数据输入员"
End Sub

Private Sub Jiwei_KeyUp(KeyCode As Integer, Shift As Integer)
   If KeyCode = 13 Or KeyCode = 40 Then
     NewPassWord.SetFocus
   End If
   
   If KeyCode = 38 Then
    GongHao.SetFocus
   End If
End Sub

Private Sub Jiwei_LostFocus()
StatusBar1.Panels(1).Text = ""
End Sub

Private Sub NewPassWord_KeyUp(KeyCode As Integer, Shift As Integer)
   If KeyCode = 13 Or KeyCode = 40 Then
     Passwordtoo.SetFocus
   End If
   
   If KeyCode = 38 Then
    jiwei.SetFocus
   End If
End Sub

Private Sub Passwordtoo_KeyUp(KeyCode As Integer, Shift As Integer)
   If KeyCode = 38 Then
    NewPassWord.SetFocus
   End If
End Sub

Private Sub SelInfo_Click()
Set RstUser = New ADODB.Recordset
   'RstUser.Open "select Name as 姓名,Gonghao as 工号,riqi as 日期,Jiwei as 职位 from Userinfo", CnnUser, adOpenStatic, adLockOptimistic, adCmdText
   RstUser.Open "select name,gonghao, riqi, JiWei,Mima from userinfo where name='" + SelInfo.Text + "'", CnnUser, adOpenStatic, adLockBatchOptimistic, adCmdText
   If Not RstUser.EOF Then
     GongHao.Text = IIf(IsNull(RstUser.Fields(1)), "", RstUser.Fields(1))
     rjriqi.Value = IIf(IsNull(RstUser.Fields(2)), "", RstUser.Fields(2))
     jiwei.Text = IIf(IsNull(RstUser.Fields(3)), "", RstUser.Fields(3))
   End If
End Sub

Private Sub Xingming_KeyUp(KeyCode As Integer, Shift As Integer)
   If KeyCode = 13 Or KeyCode = 40 Then
     GongHao.SetFocus
   End If
   
   
End Sub

⌨️ 快捷键说明

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