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

📄 t_choice_frm.frm

📁 学生选课系统。VB+Access。可进行学生信息的管理
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form t_choice_frm 
   Caption         =   "教师选课窗体"
   ClientHeight    =   8040
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   11220
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   Picture         =   "t_choice_frm.frx":0000
   ScaleHeight     =   8040
   ScaleWidth      =   11220
   WindowState     =   2  'Maximized
   Begin VB.CommandButton Command1 
      Caption         =   "清空"
      Height          =   495
      Left            =   7200
      TabIndex        =   19
      Top             =   2760
      Width           =   1215
   End
   Begin VB.TextBox txtid 
      Height          =   495
      Left            =   1800
      TabIndex        =   17
      Top             =   480
      Width           =   1215
   End
   Begin VB.ComboBox Combocourse 
      Height          =   300
      Left            =   7080
      TabIndex        =   16
      Top             =   4200
      Width           =   2055
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   735
      Left            =   6600
      Top             =   6480
      Visible         =   0   'False
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   1296
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\050531123贾晨微\db1.mdb;Persist Security Info=False"
      OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\050531123贾晨微\db1.mdb;Persist Security Info=False"
      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.TextBox Text1 
      Height          =   615
      Left            =   7080
      TabIndex        =   15
      Top             =   5280
      Width           =   2175
   End
   Begin VB.CommandButton cmdexit 
      Caption         =   "退选 》"
      Height          =   495
      Left            =   4200
      TabIndex        =   13
      Top             =   5640
      Width           =   1215
   End
   Begin VB.CommandButton cmdchoice 
      Caption         =   "《 选课"
      Height          =   495
      Left            =   4200
      TabIndex        =   12
      Top             =   4680
      Width           =   1215
   End
   Begin VB.ListBox List1 
      Height          =   2580
      ItemData        =   "t_choice_frm.frx":52DAB
      Left            =   720
      List            =   "t_choice_frm.frx":52DAD
      TabIndex        =   11
      Top             =   4320
      Width           =   2775
   End
   Begin VB.CommandButton cmdadd 
      Caption         =   "添加"
      Height          =   495
      Left            =   3720
      TabIndex        =   9
      Top             =   480
      Width           =   1215
   End
   Begin VB.TextBox txtm 
      Height          =   495
      Left            =   1800
      TabIndex        =   8
      Top             =   2760
      Width           =   1215
   End
   Begin VB.TextBox txttel 
      Height          =   615
      Left            =   6960
      TabIndex        =   6
      Top             =   1560
      Width           =   1695
   End
   Begin VB.TextBox txtzc 
      Height          =   495
      Left            =   1800
      TabIndex        =   4
      Top             =   1560
      Width           =   1215
   End
   Begin VB.TextBox txtname 
      Height          =   615
      Left            =   6960
      TabIndex        =   2
      Top             =   360
      Width           =   1695
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "课程代号为: "
      Height          =   180
      Left            =   7080
      TabIndex        =   18
      Top             =   4800
      Width           =   1080
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "请选择课程:(课程名称如下)"
      Height          =   180
      Left            =   6960
      TabIndex        =   14
      Top             =   3840
      Width           =   2340
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "已选课程名:"
      Height          =   180
      Left            =   720
      TabIndex        =   10
      Top             =   3840
      Width           =   1080
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "备注:"
      Height          =   180
      Left            =   720
      TabIndex        =   7
      Top             =   3000
      Width           =   540
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "电话:"
      Height          =   180
      Left            =   5880
      TabIndex        =   5
      Top             =   1800
      Width           =   540
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "职称:"
      Height          =   180
      Left            =   720
      TabIndex        =   3
      Top             =   1680
      Width           =   540
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "教师姓名:"
      Height          =   180
      Left            =   5640
      TabIndex        =   1
      Top             =   600
      Width           =   900
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "教师编号:"
      Height          =   180
      Left            =   720
      TabIndex        =   0
      Top             =   600
      Width           =   900
   End
End
Attribute VB_Name = "t_choice_frm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim con As ADODB.Connection
Dim coursename As String
Dim courseno As String

Private Sub cmdchoice_Click()
'选课
Dim rssc As New ADODB.Recordset
Dim query As String

If txtid.Text = "" Then
   MsgBox "请在上方的表格中输入要选课的教师信息!", vbOKOnly + vbInformation, "提示"
Else
    If Combocourse.Text = "" Then
       MsgBox "请选择课程!", vbOKOnly + vbInformation, "提示"
    Else
         query = "select * from course_teacher where " & "cno" & "  = '" & Trim(Text1.Text) & "'and " & "tno" & "  = '" & Trim(txtid.Text) & "'"
         rssc.Open query, con, adOpenKeyset, adLockOptimistic
         If Not rssc.EOF Then
            MsgBox "您已选过此课程!", vbOKOnly + vbExclamation, "提示"
         Else
             List1.AddItem Combocourse.Text
             rssc.AddNew
             rssc.Fields(1) = txtid.Text
             rssc.Fields(2) = txtname.Text
             rssc.Fields(3) = Text1.Text
             rssc.Fields(4) = Combocourse.Text
             rssc.Update
             MsgBox "选课成功!", vbOKOnly + vbExclamation, "提示"
        End If
     End If
End If
End Sub

Private Sub Combocourse_click()
'添加课程信息
Dim rsc As New ADODB.Recordset
Dim query As String
query = "select * from courseinfo where " & "cname" & " = '" & Trim(Combocourse.Text) & "'"
rsc.Open query, con, 3, 3
Text1.Text = rsc.Fields(0)
End Sub

Private Sub cmdadd_Click()
'添加教师信息
Dim rs As New ADODB.Recordset
Dim rsc As New ADODB.Recordset
Dim i As Integer
Dim query1 As String
Dim query2 As String
query1 = "SELECT * FROM course_teacher WHERE " & "tno" & "  = '" & Trim(txtid.Text) & "'"
If txtid.Text <> "" Then
    query2 = "SELECT * FROM teacherinfo WHERE " & "tno" & "  = '" & Trim(txtid.Text) & "'"
    rs.Open query2, con, 3, 3
    If Not rs.EOF Then
       txtname.Text = rs.Fields(1)
       txtzc.Text = rs.Fields(2)
       txttel.Text = rs.Fields(3)
       txtm.Text = rs.Fields(4)
       rsc.Open query1, con, 3, 3
       If rsc.RecordCount > 0 Then
          For i = 1 To rsc.RecordCount
              List1.AddItem rsc.Fields(4)
              rsc.MoveNext
          Next
       End If
    Else
        MsgBox "该教师编号不存在!", vbOKOnly + vbInformation, "提示"
        txtid.Text = ""
        txtid.SetFocus
    End If
Else
    MsgBox "请在教师编号框中输入教师编号", vbOKOnly + vbInformation, "提示"
End If
End Sub


Private Sub cmdexit_Click()
'退选
Dim rs As New ADODB.Recordset
Dim query As String
If coursename = "" Then
   MsgBox "请选择需要退选的课程!", vbOKOnly + vbInformation, "退选"
Else
    query = "SELECT * FROM course_teacher  WHERE " & " cname " & " ='" & coursename & "'"
    rs.Open query, con, adOpenKeyset, adLockOptimistic
    If MsgBox("是否退选?", vbYesNo + vbCritical, "退选") = vbYes Then
       rs.Delete
       rs.Update
       List1.RemoveItem courseno
       MsgBox "退选成功!", vbOKOnly + vbInformation, "提示"
    End If
End If
End Sub

Private Sub command1_click()
'清空
Dim rsc As New ADODB.Recordset
Dim query As String
Dim i As Integer
txtid.Text = ""
txtname.Text = ""
txttel.Text = ""
txtm.Text = ""
txtzc.Text = ""
Text1.Text = ""
Combocourse.Clear
List1.Clear
query = "select * from courseinfo"
rsc.Open query, con, 3, 3
If rsc.RecordCount > 0 Then
   For i = 1 To rsc.RecordCount
       Combocourse.AddItem rsc.Fields(1)
       rsc.MoveNext
   Next
End If
txtid.SetFocus
End Sub

Private Sub Form_Load()
'创建连接
Dim rsc As New ADODB.Recordset
Dim query As String
Dim i As Integer
Set con = New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\050531123贾晨微\db1.mdb;Persist Security Info=False"
con.CursorLocation = adUseClient
con.Open
query = "select * from courseinfo"
rsc.Open query, con, 3, 3
If rsc.RecordCount > 0 Then
   For i = 1 To rsc.RecordCount
       Combocourse.AddItem rsc.Fields(1)
       rsc.MoveNext
   Next
End If
End Sub

Private Sub List1_Click()
  coursename = List1.Text
  courseno = List1.ListIndex
End Sub

⌨️ 快捷键说明

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