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

📄 修改信息.frm

📁 很好的VB加SQL系统,可以实现删除擦看添加等功能
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form4 
   Caption         =   "信息修改"
   ClientHeight    =   7140
   ClientLeft      =   60
   ClientTop       =   435
   ClientWidth     =   9615
   LinkTopic       =   "Form4"
   ScaleHeight     =   7140
   ScaleWidth      =   9615
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command4 
      Caption         =   "修改"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   2520
      TabIndex        =   27
      Top             =   6120
      Width           =   1695
   End
   Begin VB.TextBox Text1 
      Height          =   615
      Left            =   2760
      TabIndex        =   14
      Top             =   240
      Width           =   1935
   End
   Begin VB.TextBox Text2 
      Height          =   615
      Left            =   2760
      TabIndex        =   13
      Top             =   1200
      Width           =   1935
   End
   Begin VB.TextBox Text3 
      Height          =   615
      Left            =   2760
      TabIndex        =   12
      Top             =   2160
      Width           =   1935
   End
   Begin VB.TextBox Text4 
      Height          =   615
      Left            =   2760
      TabIndex        =   11
      Top             =   3120
      Width           =   1935
   End
   Begin VB.TextBox Text5 
      Height          =   615
      Left            =   2760
      TabIndex        =   10
      Top             =   4080
      Width           =   1935
   End
   Begin VB.TextBox Text6 
      Height          =   615
      Left            =   2760
      TabIndex        =   9
      Top             =   5040
      Width           =   1935
   End
   Begin VB.TextBox Text7 
      Height          =   615
      Left            =   7320
      TabIndex        =   8
      Top             =   240
      Width           =   1815
   End
   Begin VB.TextBox Text8 
      Height          =   615
      Left            =   7320
      TabIndex        =   7
      Top             =   1200
      Width           =   1815
   End
   Begin VB.TextBox Text9 
      Height          =   615
      Left            =   7320
      TabIndex        =   6
      Top             =   2160
      Width           =   1815
   End
   Begin VB.TextBox Text10 
      Height          =   615
      Left            =   7320
      TabIndex        =   5
      Top             =   3120
      Width           =   1815
   End
   Begin VB.TextBox Text11 
      Height          =   615
      Left            =   7320
      TabIndex        =   4
      Top             =   4080
      Width           =   1815
   End
   Begin VB.TextBox Text12 
      Height          =   615
      Left            =   7320
      TabIndex        =   3
      Top             =   5040
      Width           =   1815
   End
   Begin VB.CommandButton Command1 
      Caption         =   "查询"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   480
      TabIndex        =   2
      Top             =   6120
      Width           =   1575
   End
   Begin VB.CommandButton Command2 
      Caption         =   "清除"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   4680
      TabIndex        =   1
      Top             =   6120
      Width           =   1815
   End
   Begin VB.CommandButton Command3 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   7080
      TabIndex        =   0
      Top             =   6120
      Width           =   1935
   End
   Begin VB.Label Label1 
      Caption         =   "编号:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   26
      Top             =   360
      Width           =   2175
   End
   Begin VB.Label Label2 
      Caption         =   "姓名:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   25
      Top             =   1320
      Width           =   2175
   End
   Begin VB.Label Label3 
      Caption         =   "部门:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   24
      Top             =   2280
      Width           =   2175
   End
   Begin VB.Label Label4 
      Caption         =   "性别:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   23
      Top             =   3240
      Width           =   2175
   End
   Begin VB.Label Label5 
      Caption         =   "生日:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   22
      Top             =   4200
      Width           =   2175
   End
   Begin VB.Label Label6 
      Caption         =   "籍贯:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   21
      Top             =   5160
      Width           =   2175
   End
   Begin VB.Label Label7 
      Caption         =   "学历:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4920
      TabIndex        =   20
      Top             =   360
      Width           =   2055
   End
   Begin VB.Label Label8 
      Caption         =   "专业:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4920
      TabIndex        =   19
      Top             =   1320
      Width           =   2055
   End
   Begin VB.Label Label9 
      Caption         =   "参加工作时间:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4920
      TabIndex        =   18
      Top             =   2280
      Width           =   2055
   End
   Begin VB.Label Label10 
      Caption         =   "入党时间:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4920
      TabIndex        =   17
      Top             =   3240
      Width           =   2055
   End
   Begin VB.Label Label11 
      Caption         =   "职称:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4920
      TabIndex        =   16
      Top             =   4200
      Width           =   2055
   End
   Begin VB.Label Label12 
      Caption         =   "进入公司时间:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4920
      TabIndex        =   15
      Top             =   5160
      Width           =   1935
   End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim cnn As ADODB.Connection
    Dim rs As ADODB.Recordset
    
    
    Set cnn = New ADODB.Connection
    Set rs = New ADODB.Recordset
    
    Dim connectionString As String
    connectionString = "dsn=人事管理;uid=sa;pwd=;"
    
    cnn.Open connectionString
    
    Dim sqlString As String
    sqlString = "select * from 员工基本信息 where 编号='" & Text1.Text & "'"
    
    rs.Open sqlString, cnn
    
    Do While Not rs.EOF
        Text1.Text = rs("编号")
        Text2.Text = rs("姓名")
        Text3.Text = rs("部门")
        Text4.Text = rs("性别")
        Text5.Text = rs("生日")
        Text6.Text = rs("籍贯")
        Text7.Text = rs("学历")
        Text8.Text = rs("专业")
        Text9.Text = rs("参加工作时间")
        Text10.Text = rs("入党时间")
        Text11.Text = rs("职称")
        Text12.Text = rs("进入公司时间")
        
         MsgBox rs("编号")
         rs.MoveNext
    Loop
    
    rs.Close
    
    cnn.Close
End Sub

Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""

End Sub

Private Sub Command3_Click()
Visible = False
Form1.Visible = True
Unload Form4
End Sub

Private Sub Command4_Click()
 Dim cnn As ADODB.Connection
    Dim rs As ADODB.Recordset
    
    
    Set cnn = New ADODB.Connection
    Set rs = New ADODB.Recordset
    
    Dim connectionString As String
    connectionString = "dsn=人事管理;uid=sa;pwd=;"
    
    cnn.Open connectionString
    
    Dim 编号 As String
    编号 = Text1.Text
    Dim 姓名 As String
    姓名 = Text2.Text
    Dim 部门 As String
    部门 = Text3.Text
     Dim 性别 As String
    性别 = Text4.Text
    Dim 生日 As String
    生日 = Text5.Text
    Dim 籍贯 As String
    籍贯 = Text6.Text
    Dim 学历 As String
    学历 = Text7.Text
    Dim 专业 As String
    专业 = Text8.Text
     Dim 参加工作时间 As String
    参加工作时间 = Text9.Text
    Dim 入党时间 As String
    入党时间 = Text10.Text
    Dim 职称 As String
    职称 = Text11.Text
    Dim 进入公司时间 As String
    进入公司时间 = Text12.Text
    
    
    
    Dim sqlString As String
    sqlString = "update 员工基本信息 set 姓名='" & 姓名 & "',部门='" & 部门 & "',性别='" & 性别 & "',生日='" & 生日 & "',籍贯='" & 籍贯 & "',学历='" & 学历 & "',专业='" & 专业 & "',参加工作时间='" & 参加工作时间 & "',入党时间='" & 入党时间 & "',职称='" & 职称 & "',进入公司时间='" & 进入公司时间 & "' where 编号='" & 编号 & "'"
   
    
    MsgBox sqlString
    
    cnn.Execute sqlString
    
    sqlString = "select * from 员工基本信息"
    
    rs.Open sqlString, cnn
    
  
    
    rs.Close
    
    cnn.Close
End Sub

⌨️ 快捷键说明

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