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

📄 formclass1.frm

📁 用VB连接ORalce数据库的学生管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Formclass1 
   BackColor       =   &H00FFC0FF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "添加班级"
   ClientHeight    =   6315
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6630
   Icon            =   "Formclass1.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6315
   ScaleWidth      =   6630
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "班级设置"
      Height          =   4335
      Left            =   600
      TabIndex        =   3
      Top             =   1200
      Width           =   5055
      Begin VB.TextBox Text1 
         BackColor       =   &H80000018&
         ForeColor       =   &H000000FF&
         Height          =   300
         Index           =   0
         Left            =   1080
         MaxLength       =   16
         TabIndex        =   11
         Top             =   600
         Width           =   1095
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H80000018&
         ForeColor       =   &H000000FF&
         Height          =   300
         Index           =   1
         Left            =   3360
         MaxLength       =   20
         TabIndex        =   10
         Top             =   600
         Width           =   1095
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H80000018&
         ForeColor       =   &H000000FF&
         Height          =   300
         Index           =   2
         Left            =   1080
         MaxLength       =   5
         TabIndex        =   9
         Top             =   1560
         Width           =   1095
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H80000018&
         ForeColor       =   &H000000FF&
         Height          =   300
         Index           =   3
         Left            =   3360
         MaxLength       =   8
         TabIndex        =   8
         Top             =   1560
         Width           =   1095
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H80000018&
         ForeColor       =   &H000000FF&
         Height          =   300
         Index           =   4
         Left            =   1080
         MaxLength       =   16
         TabIndex        =   7
         Top             =   2520
         Width           =   1095
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H80000018&
         ForeColor       =   &H000000FF&
         Height          =   300
         Index           =   5
         Left            =   3360
         MaxLength       =   8
         TabIndex        =   6
         Top             =   2520
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   375
         Left            =   840
         TabIndex        =   5
         Top             =   3480
         Width           =   1215
      End
      Begin VB.CommandButton Command2 
         Caption         =   "返回"
         Height          =   375
         Left            =   2640
         TabIndex        =   4
         Top             =   3480
         Width           =   1215
      End
      Begin VB.Label Label2 
         BackColor       =   &H00FFC0FF&
         Caption         =   "年级:"
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   0
         Left            =   360
         TabIndex        =   17
         Top             =   720
         Width           =   615
      End
      Begin VB.Label Label2 
         BackColor       =   &H00FFC0FF&
         Caption         =   "班级:"
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   1
         Left            =   2640
         TabIndex        =   16
         Top             =   720
         Width           =   615
      End
      Begin VB.Label Label2 
         BackColor       =   &H00FFC0FF&
         Caption         =   "教室:"
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   2
         Left            =   360
         TabIndex        =   15
         Top             =   1560
         Width           =   615
      End
      Begin VB.Label Label2 
         BackColor       =   &H00FFC0FF&
         Caption         =   "年制:"
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   3
         Left            =   2640
         TabIndex        =   14
         Top             =   1560
         Width           =   615
      End
      Begin VB.Label Label2 
         BackColor       =   &H00FFC0FF&
         Caption         =   "系别:"
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   4
         Left            =   360
         TabIndex        =   13
         Top             =   2520
         Width           =   615
      End
      Begin VB.Label Label2 
         BackColor       =   &H00FFC0FF&
         Caption         =   "班主任:"
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   5
         Left            =   2520
         TabIndex        =   12
         Top             =   2520
         Width           =   735
      End
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   4200
      Top             =   360
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   582
      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.Image Image4 
      Height          =   480
      Left            =   720
      Picture         =   "Formclass1.frx":0442
      Top             =   360
      Width           =   480
   End
   Begin VB.Label Label7 
      Height          =   255
      Left            =   2880
      TabIndex        =   2
      Top             =   2040
      Width           =   615
   End
   Begin VB.Label Label4 
      Height          =   255
      Left            =   600
      TabIndex        =   1
      Top             =   1920
      Width           =   615
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "添加班级"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   26.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   735
      Left            =   1920
      TabIndex        =   0
      Top             =   240
      Width           =   2295
   End
End
Attribute VB_Name = "Formclass1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
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
Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
sql = "select * from class where class='" & Trim(Text1(1).Text) & "'"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql
Adodc1.Refresh
If Adodc1.Recordset.EOF = False Then
    MsgBox " 已经存在班级号为" & Trim(Text1(1).Text) & "的班级!", 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).Text = ""
 Text1(3).SetFocus
 Exit Sub
End If
If Trim(Text1(4).Text) = "" Then
 MsgBox "系别不能为空!", vbExclamation + vbOKOnly, "警告"
 Text1(4).Text = ""
 Text1(4).SetFocus
 Exit Sub
End If
If Trim(Text1(5).Text) = "" Then
 MsgBox "班主任不能为空!", vbExclamation + vbOKOnly, "警告"
 Text1(5).Text = ""
 Text1(5).SetFocus
 Exit Sub
End If

Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
sql = "select * from class where class='" & Trim(Text1(1).Text) & "'"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql
Adodc1.Refresh
If Adodc1.Recordset.EOF = False Then
  MsgBox " 该班级名已经存在!", vbExclamation + vbOKOnly, "警告"
  Text1(1).SetFocus
  Text1(1).SelStart = 0
  Text1(1).SelLength = Len(Text1(1).Text)
  Exit Sub
End If

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(Text1(4).Text)
Adodc1.Recordset.Fields("teacher").Value = Trim(Text1(5).Text)
Adodc1.Recordset.Update
Adodc1.Refresh
MsgBox " 班级添加成功!", vbInformation + vbOKOnly, "警告"
Text1(0).Text = ""
Text1(1).Text = ""
Text1(2).Text = ""
Text1(3).Text = ""
Text1(4).Text = ""
Text1(5).Text = ""
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

⌨️ 快捷键说明

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