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

📄 修改教师基本信息.frm

📁 简单课设学生成绩管理系统---VB程序模块,VB与SQL的结合,包括增删改查等功能,还包括连表查询.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form4 
   BackColor       =   &H00FFFF00&
   Caption         =   "Form4"
   ClientHeight    =   4335
   ClientLeft      =   60
   ClientTop       =   435
   ClientWidth     =   5625
   LinkTopic       =   "Form4"
   ScaleHeight     =   4335
   ScaleWidth      =   5625
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command4 
      Caption         =   "修改"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3960
      TabIndex        =   13
      Top             =   1320
      Width           =   1335
   End
   Begin VB.CommandButton Command3 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3960
      TabIndex        =   12
      Top             =   3360
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Caption         =   "清除"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3960
      TabIndex        =   11
      Top             =   2280
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "查询"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3960
      TabIndex        =   10
      Top             =   240
      Width           =   1335
   End
   Begin VB.TextBox Text5 
      Height          =   495
      Left            =   2040
      TabIndex        =   9
      Top             =   3360
      Width           =   1695
   End
   Begin VB.TextBox Text4 
      Height          =   495
      Left            =   2040
      TabIndex        =   7
      Top             =   2520
      Width           =   1695
   End
   Begin VB.TextBox Text3 
      Height          =   495
      Left            =   2040
      TabIndex        =   5
      Top             =   1800
      Width           =   1695
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   2040
      TabIndex        =   3
      Top             =   1080
      Width           =   1695
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   2040
      TabIndex        =   1
      Top             =   240
      Width           =   1695
   End
   Begin VB.Label Label5 
      BackColor       =   &H00FFFF00&
      Caption         =   "职称:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   0
      TabIndex        =   8
      Top             =   3360
      Width           =   1815
   End
   Begin VB.Label Label4 
      BackColor       =   &H00FFFF00&
      Caption         =   "所属系别:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   0
      TabIndex        =   6
      Top             =   2520
      Width           =   1815
   End
   Begin VB.Label Label3 
      BackColor       =   &H00FFFF00&
      Caption         =   "性别:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   0
      TabIndex        =   4
      Top             =   1800
      Width           =   1815
   End
   Begin VB.Label Label2 
      BackColor       =   &H00FFFF00&
      Caption         =   "姓名:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   0
      TabIndex        =   2
      Top             =   1080
      Width           =   1695
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFFF00&
      Caption         =   "教师号:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   0
      TabIndex        =   0
      Top             =   240
      Width           =   1695
   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("职称")
        
         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 = ""

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 xh As String
    xh = Text1.Text
    Dim xm As String
    xm = Text2.Text
    Dim xb As String
    xb = Text3.Text
     Dim sr As String
    sr = Text4.Text
    Dim bj As String
    bj = Text5.Text
    
    
    
    Dim sqlString As String
    sqlString = "update 教师基本信息 set 姓名='" & xm & "',性别='" & xb & "',所属系别='" & sr & "',职称='" & bj & "' where 教师号='" & xh & "'"
   
    
    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 + -