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

📄 frmjiben.frm

📁 用VB连接ORalce数据库的学生管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmjiben 
   BackColor       =   &H00FFC0FF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "基本课程设置"
   ClientHeight    =   5910
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4920
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   5910
   ScaleWidth      =   4920
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   3600
      Top             =   240
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _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.Frame Frame1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "课程"
      Height          =   4575
      Left            =   120
      TabIndex        =   0
      Top             =   960
      Width           =   4695
      Begin VB.CommandButton Command2 
         Caption         =   "取消"
         Height          =   375
         Left            =   2640
         TabIndex        =   15
         Top             =   3960
         Width           =   975
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   375
         Left            =   480
         TabIndex        =   14
         Top             =   3960
         Width           =   975
      End
      Begin VB.TextBox Text6 
         Height          =   390
         Left            =   1920
         TabIndex        =   9
         Top             =   3240
         Width           =   1935
      End
      Begin VB.TextBox Text5 
         Height          =   390
         Left            =   1920
         TabIndex        =   8
         Top             =   2640
         Width           =   1935
      End
      Begin VB.TextBox Text4 
         Height          =   375
         Left            =   1920
         TabIndex        =   7
         Top             =   2040
         Width           =   1935
      End
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   1920
         TabIndex        =   6
         Top             =   1440
         Width           =   1935
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   1920
         TabIndex        =   5
         Top             =   840
         Width           =   1935
      End
      Begin VB.TextBox Text1 
         Height          =   390
         Left            =   1920
         TabIndex        =   3
         Top             =   240
         Width           =   1935
      End
      Begin MSAdodcLib.Adodc Adodc2 
         Height          =   375
         Left            =   3120
         Top             =   5760
         Visible         =   0   'False
         Width           =   1200
         _ExtentX        =   2117
         _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        =   ""
         Password        =   ""
         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 Label7 
         BackColor       =   &H00FFC0FF&
         Caption         =   "学分"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   480
         TabIndex        =   13
         Top             =   3360
         Width           =   1335
      End
      Begin VB.Label Label6 
         BackColor       =   &H00FFC0FF&
         Caption         =   "限定人数"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   480
         TabIndex        =   12
         Top             =   2760
         Width           =   1455
      End
      Begin VB.Label Label5 
         BackColor       =   &H00FFC0FF&
         Caption         =   "职称"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   480
         TabIndex        =   11
         Top             =   2160
         Width           =   1095
      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
         Height          =   375
         Left            =   480
         TabIndex        =   10
         Top             =   1560
         Width           =   855
      End
      Begin VB.Label Label3 
         BackColor       =   &H00FFC0FF&
         Caption         =   "课程名"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   480
         TabIndex        =   4
         Top             =   960
         Width           =   1095
      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
         Height          =   375
         Left            =   480
         TabIndex        =   2
         Top             =   360
         Width           =   1335
      End
   End
   Begin VB.Image Image4 
      Height          =   480
      Left            =   600
      Picture         =   "frmjiben.frx":0000
      Top             =   240
      Width           =   480
   End
   Begin VB.Label Label1 
      Caption         =   "添加课程"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   21.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   375
      Left            =   1320
      TabIndex        =   1
      Top             =   240
      Width           =   2775
   End
End
Attribute VB_Name = "frmjiben"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click()
If Trim(Text1.Text) = "" Then
 MsgBox "课程号不能为空!", vbExclamation + vbOKOnly, "警告"
 Text1.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 Trim(Text4.Text) = "" Then
 MsgBox "职称不能为空!", vbExclamation + vbOKOnly, "警告"
 Text4.SetFocus
 Exit Sub
End If
If Trim(Text5.Text) = "" Then
 MsgBox "选课人数不能为空!", vbExclamation + vbOKOnly, "警告"
 Text5.SetFocus
 Exit Sub
End If
If Trim(Text6.Text) = "" Then
 MsgBox "学分不能为空!", vbExclamation + vbOKOnly, "警告"
 Text6.SetFocus
 Exit Sub
End If

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

Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("cno").Value = Trim(Text1.Text)
Adodc1.Recordset.Fields("cname").Value = Trim(Text2.Text)
Adodc1.Recordset.Fields("teacher").Value = Trim(Text3.Text)
Adodc1.Recordset.Fields("profession").Value = Trim(Text4.Text)
Adodc1.Recordset.Fields("snum").Value = Val(Text5.Text)
Adodc1.Recordset.Fields("course").Value = Val(Text6.Text)
Adodc1.Recordset.Update
Adodc1.Refresh
MsgBox " 班级添加成功!", vbInformation + vbOKOnly, "警告"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""

End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

⌨️ 快捷键说明

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