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

📄 formclass4.frm

📁 用VB连接ORalce数据库的学生管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      End
      Begin VB.Label Label2 
         BackColor       =   &H00FFC0FF&
         Caption         =   "班级:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   375
         Left            =   600
         TabIndex        =   8
         Top             =   840
         Width           =   975
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FFC0FF&
         Caption         =   "教室:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   375
         Left            =   600
         TabIndex        =   7
         Top             =   1440
         Width           =   975
      End
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   5880
      Top             =   360
      Visible         =   0   'False
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   "he"
      Password        =   "he"
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Label Label10 
      BackColor       =   &H00FFC0FF&
      Caption         =   "修改班级档案"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   26.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   615
      Left            =   1680
      TabIndex        =   13
      Top             =   0
      Width           =   3375
   End
   Begin VB.Image Image1 
      Height          =   480
      Left            =   840
      Picture         =   "Formclass4.frx":0000
      Top             =   120
      Width           =   480
   End
End
Attribute VB_Name = "Formclass4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public printstr As String
Private Sub Command1_Click()
    If Trim(Text1(6).Text) = "" Then
        MsgBox "班级号不能为空!", vbExclamation + vbOKOnly, "警告"
        Text1(6).SetFocus
        Exit Sub
    End If
    If Trim(Text1(7).Text) = "" And Text1(4).Text = "" Then
        sql = "select * from class where class='" & Trim(Text1(6).Text) & "'"
    End If
    If Trim(Text1(7).Text) = "" And Text1(4).Text <> "" Then
        sql = "select * from class where class='" & Trim(Text1(6).Text) & "' and teacher='" & Trim(Text1(4).Text) & "'"
    End If
    If Trim(Text1(7).Text) <> "" And Text1(4).Text = "" Then
        sql = "select * from class where class='" & Trim(Text1(6).Text) & "' and grd='" & Trim(Text1(7).Text) & "'"
    End If
    If Trim(Text1(7).Text) <> "" And Text1(4).Text <> "" Then
        sql = "select * from class where class='" & Trim(Text1(6).Text) & "' and teacher='" & Trim(Text1(4).Text) & "' and grd='" & Trim(Text1(7).Text) & "'"
    End If
    Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = sql
    Adodc1.Refresh
    If Adodc1.Recordset.EOF = True Then
        MsgBox " 不存在班级号为" & Trim(Text1(6).Text) & "的班级!", vbExclamation + vbOKOnly, "警告"
        Text1(6).SetFocus
        Exit Sub
    End If
    If Trim(Text1(0).Text) = "" Then
        MsgBox "年级不能为空!", vbExclamation + vbOKOnly, "警告"
        Text1(0).SetFocus
        Exit Sub
    End If
    If Trim(Text1(1).Text) = "" Then
        MsgBox "班级不能为空!", vbExclamation + vbOKOnly, "警告"
        Text1(1).SetFocus
        Exit Sub
    End If
    If Trim(Text1(2).Text) = "" Then
        MsgBox "教室不能为空!", vbExclamation + vbOKOnly, "警告"
        Text1(2).SetFocus
        Exit Sub
    End If
    If Trim(Text1(3).Text) = "" Then
        MsgBox "学年制不能为空!", vbExclamation + vbOKOnly, "警告"
        Text1(3).SetFocus
        Exit Sub
    End If
    If Trim(Text2.Text) = "" Then
        MsgBox "系别不能为空!", vbExclamation + vbOKOnly, "警告"
        Text2.SetFocus
        Exit Sub
    End If
    If Trim(Text3.Text) = "" Then
        MsgBox "班主任不能为空!", vbExclamation + vbOKOnly, "警告"
        Text3.SetFocus
        Exit Sub
    End If
    If MsgBox("确定要修改吗?", vbExclamation + vbOKCancel, "警告") = vbOK Then
        Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
        Adodc1.CommandType = adCmdText
        Adodc1.RecordSource = sql
        Adodc1.Refresh
        Adodc1.Recordset.Delete
        Adodc1.Refresh
        Adodc1.Recordset.AddNew
        Adodc1.Recordset.Fields("grd").Value = Trim(Text1(0).Text)
        Adodc1.Recordset.Fields("class").Value = Trim(Text1(1).Text)
        Adodc1.Recordset.Fields("room").Value = Trim(Text1(2).Text)
        Adodc1.Recordset.Fields("year").Value = Trim(Text1(3).Text)
        Adodc1.Recordset.Fields("dept").Value = Trim(Text2.Text)
        Adodc1.Recordset.Fields("teacher").Value = Trim(Text3.Text)
        Adodc1.Recordset.Update
        Adodc1.Refresh
        MsgBox " 修改成功!", vbExclamation + vbOKOnly, "警告"
        Text1(0).Text = ""
        Text1(1).Text = ""
        Text1(2).Text = ""
        Text1(3).Text = ""
        Text2.Text = ""
        Text3.Text = ""
    End If
    Text1(0).Text = ""
    Text1(1).Text = ""
    Text1(2).Text = ""
    Text1(3).Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Formclass2.printstr = sql
End Sub

Private Sub Command2_Click()
Unload Me
End Sub


Private Sub Command3_Click()
    If Trim(Text1(6).Text) = "" Then
        MsgBox "班级号不能为空!", vbExclamation + vbOKOnly, "警告"
        Text1(6).SetFocus
        Exit Sub
    End If
    If Trim(Text1(7).Text) = "" And Text1(4).Text = "" Then
        sql = "select * from class where class='" & Trim(Text1(6).Text) & "'"
    End If
    If Trim(Text1(7).Text) = "" And Text1(4).Text <> "" Then
        sql = "select * from class where class='" & Trim(Text1(6).Text) & "' and teacher='" & Trim(Text1(4).Text) & "'"
    End If
    If Trim(Text1(7).Text) <> "" And Text1(4).Text = "" Then
        sql = "select * from class where class='" & Trim(Text1(6).Text) & "' and grd='" & Trim(Text1(7).Text) & "'"
    End If
    If Trim(Text1(7).Text) <> "" And Text1(4).Text <> "" Then
        sql = "select * from class where class='" & Trim(Text1(6).Text) & "' and teacher='" & Trim(Text1(4).Text) & "' and grd='" & Trim(Text1(7).Text) & "'"
    End If
    Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = sql
    Adodc1.Refresh
    If Adodc1.Recordset.EOF = True Then
        MsgBox " 不存在班级号为" & Trim(Text1(6).Text) & "的学生!", vbExclamation + vbOKOnly, "警告"
        Text1(6).SetFocus
        Exit Sub
    End If
    If MsgBox("确定要删除班级号为" & Text1(6).Text & "的班级吗?" & Chr(13) & Chr(10) & "继续会导致该班的记录和相关记录的数据丢失,继续吗?", vbExclamation + vbOKCancel, "警告") = vbOK Then
        Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
        Adodc1.CommandType = adCmdText
        Adodc1.RecordSource = sql
        Adodc1.Refresh
        If Adodc1.Recordset.EOF = True Then
           MsgBox "对不起,没该班的记录!", vbOKOnly, "查询"
           Text1(6).SetFocus
           Exit Sub
        End If
        Adodc1.Recordset.Delete
        Adodc1.Refresh
        sql = "select * from student where class ='" & Trim(Text1(6).Text) & "'"
        Adodc1.CommandType = adCmdText
        Adodc1.RecordSource = sql
        If Adodc1.Recordset.EOF = True Then
            MsgBox "学生表中没有该班的学生的信息!", vbOKOnly, "查询"
            GoTo a
        End If
        Adodc1.Recordset.Delete  '删除student表中的数据
        Adodc1.Refresh
a:       MsgBox "删除成功!", vbOKOnly, "查询"
        Text1(7).Text = ""
        Text1(6).Text = ""
        Text1(4).Text = ""
    End If
        Text1(7).Text = ""
        Text1(6).Text = ""
        Text1(4).Text = ""
End Sub

⌨️ 快捷键说明

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