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

📄 t_choice_frm.frm

📁 一套很不错的学生选课系统及学生信息管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form t_choice_frm 
   Caption         =   "教师选课"
   ClientHeight    =   4590
   ClientLeft      =   4080
   ClientTop       =   4980
   ClientWidth     =   6855
   LinkTopic       =   "Form1"
   ScaleHeight     =   4590
   ScaleWidth      =   6855
   Begin MSAdodcLib.Adodc course_teacher 
      Height          =   375
      Left            =   1440
      Top             =   2160
      Visible         =   0   'False
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   661
      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=E:\VB实习\DB1.MDB;Persist Security Info=False"
      OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\VB实习\DB1.MDB;Persist Security Info=False"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "course_teacher"
      Caption         =   "Adodc2"
      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.CommandButton Command3 
      Caption         =   "确定"
      Enabled         =   0   'False
      Height          =   375
      Left            =   3000
      TabIndex        =   16
      Top             =   3360
      Width           =   975
   End
   Begin MSAdodcLib.Adodc course 
      Height          =   330
      Left            =   3000
      Top             =   2160
      Visible         =   0   'False
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   582
      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=E:\VB实习\db1.mdb;Persist Security Info=False"
      OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\VB实习\db1.mdb;Persist Security Info=False"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "courseinfo"
      Caption         =   "Adodc2"
      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 MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   5520
      Top             =   120
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   661
      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=E:\VB实习\db1.mdb;Persist Security Info=False"
      OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\VB实习\db1.mdb;Persist Security Info=False"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "teacherinfo"
      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.ListBox List1 
      DataSource      =   "course_teacher"
      Height          =   1680
      Left            =   480
      TabIndex        =   14
      Top             =   2640
      Width           =   1695
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退选>>"
      Height          =   375
      Left            =   3000
      TabIndex        =   12
      Top             =   3960
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "<<选课"
      Height          =   375
      Left            =   3000
      TabIndex        =   11
      Top             =   2760
      Width           =   975
   End
   Begin VB.ComboBox Combo2 
      DataSource      =   "course"
      Height          =   1620
      Left            =   4680
      Style           =   1  'Simple Combo
      TabIndex        =   10
      Top             =   2640
      Width           =   1815
   End
   Begin VB.ComboBox Combo1 
      DataSource      =   "Adodc1"
      Height          =   300
      Left            =   1200
      TabIndex        =   9
      Top             =   120
      Width           =   975
   End
   Begin VB.TextBox Text5 
      DataSource      =   "Adodc1"
      Enabled         =   0   'False
      Height          =   270
      Left            =   3960
      TabIndex        =   3
      Top             =   120
      Width           =   1095
   End
   Begin VB.TextBox Text6 
      DataSource      =   "Adodc1"
      Enabled         =   0   'False
      Height          =   270
      Left            =   1200
      TabIndex        =   2
      Top             =   600
      Width           =   975
   End
   Begin VB.TextBox Text7 
      DataSource      =   "Adodc1"
      Enabled         =   0   'False
      Height          =   270
      Left            =   3960
      TabIndex        =   1
      Top             =   600
      Width           =   1095
   End
   Begin VB.TextBox Text8 
      DataSource      =   "Adodc1"
      Enabled         =   0   'False
      Height          =   615
      Left            =   960
      TabIndex        =   0
      Top             =   1200
      Width           =   2775
   End
   Begin VB.Label label7 
      Caption         =   "已选课程"
      Height          =   255
      Left            =   480
      TabIndex        =   15
      Top             =   2280
      Width           =   1695
   End
   Begin VB.Label Label1 
      Caption         =   "供选课程"
      Height          =   255
      Left            =   4680
      TabIndex        =   13
      Top             =   2280
      Width           =   1815
   End
   Begin VB.Label Label2 
      Caption         =   "教师编号:"
      Height          =   255
      Left            =   240
      TabIndex        =   8
      Top             =   120
      Width           =   1095
   End
   Begin VB.Label Label3 
      Caption         =   "教师姓名:"
      Height          =   255
      Left            =   3120
      TabIndex        =   7
      Top             =   120
      Width           =   975
   End
   Begin VB.Label Label4 
      Caption         =   "教师职称:"
      Height          =   255
      Left            =   240
      TabIndex        =   6
      Top             =   600
      Width           =   975
   End
   Begin VB.Label Label5 
      Caption         =   "电话:"
      Height          =   255
      Left            =   3120
      TabIndex        =   5
      Top             =   600
      Width           =   735
   End
   Begin VB.Label Label6 
      Caption         =   "备注:"
      Height          =   255
      Left            =   240
      TabIndex        =   4
      Top             =   1200
      Width           =   735
   End
   Begin VB.Line Line1 
      X1              =   240
      X2              =   6480
      Y1              =   2040
      Y2              =   2040
   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 cno As String
Dim cname As String
Private Sub Combo1_Click()
List1.Clear
Adodc1.Recordset.MoveFirst
Do While Not Adodc1.Recordset.EOF
If Combo1.Text = Adodc1.Recordset.Fields(0) Then
    'Adodc1.Recordset.Move
    Text5 = Adodc1.Recordset.Fields(1)
    Text6 = Adodc1.Recordset.Fields(2)
    Text7 = Adodc1.Recordset.Fields(3)
    Text8 = Adodc1.Recordset.Fields(4)
    Exit Do
End If
Adodc1.Recordset.MoveNext
Loop
    course_teacher.Recordset.MoveFirst
    Do While Not course_teacher.Recordset.EOF
        If course_teacher.Recordset.Fields(1) = Combo1.Text Then
            cno = course_teacher.Recordset.Fields(2)
            
            course.Recordset.MoveFirst
            Do While Not course.Recordset.EOF
                If cno = course.Recordset.Fields(0) Then
                    cname = course.Recordset.Fields(1)
                End If
            course.Recordset.MoveNext
            Loop

            List1.AddItem cname
        End If
        course_teacher.Recordset.MoveNext
    Loop

End Sub

Private Sub Combo2_click()
    course.Recordset.MoveFirst
       Do While Not course.Recordset.EOF
       If Combo2.Text = course.Recordset.Fields(1) Then
            cno = course.Recordset.Fields(0)
           
        End If
        course.Recordset.MoveNext
    Loop

End Sub

Private Sub Command1_Click()
Command1.Enabled = False
List1.AddItem Combo2.Text
Combo2.RemoveItem Combo2.ListIndex
Command3.Enabled = True
Combo2.Enabled = False
End Sub

Private Sub Command2_Click()
List1.Clear
Combo2.Clear
Combo2.Enabled = True
Command3.Enabled = False
Command1.Enabled = True
    course.Recordset.MoveFirst
    Do While Not course.Recordset.EOF
        Combo2.AddItem course.Recordset.Fields(1)
        course.Recordset.MoveNext
    Loop

End Sub

Private Sub Command3_Click()
    '保存记录
    Dim myrs As New ADODB.Recordset

    myrs.Open "SELECT * FROM course_teacher", con, adOpenDynamic, adLockOptimistic, adCmdText
    myrs.AddNew

    myrs.Fields(1) = Combo1.Text
    myrs.Fields(2) = cno
    myrs.Fields(3) = Text8

    myrs.Update
    MsgBox "选课成功!"
    Unload Me

End Sub

Private Sub Form_Load()
    Set con = New ADODB.Connection
    con.ConnectionString = Adodc1.ConnectionString
    con.CursorLocation = adUseClient
    con.Open
    Adodc1.Recordset.MoveFirst
    Do While Not Adodc1.Recordset.EOF
        Combo1.AddItem Adodc1.Recordset.Fields(0)
        Adodc1.Recordset.MoveNext
    Loop
    course.Recordset.MoveFirst
    Do While Not course.Recordset.EOF
        Combo2.AddItem course.Recordset.Fields(1)
        course.Recordset.MoveNext
    Loop

End Sub

⌨️ 快捷键说明

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