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

📄 s_choice_frm.frm

📁 一套很不错的学生选课系统及学生信息管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Top             =   3000
      Width           =   855
   End
   Begin VB.TextBox Text6 
      DataSource      =   "Adodc1"
      Enabled         =   0   'False
      Height          =   270
      Left            =   4680
      TabIndex        =   13
      Top             =   1080
      Width           =   2415
   End
   Begin VB.TextBox Text5 
      DataSource      =   "Adodc1"
      Enabled         =   0   'False
      Height          =   270
      Left            =   4680
      TabIndex        =   12
      Top             =   600
      Width           =   1335
   End
   Begin VB.TextBox Text4 
      DataSource      =   "Adodc1"
      Enabled         =   0   'False
      Height          =   270
      Left            =   4680
      TabIndex        =   11
      Top             =   120
      Width           =   1335
   End
   Begin VB.TextBox Text3 
      DataSource      =   "Adodc1"
      Enabled         =   0   'False
      Height          =   495
      Left            =   1680
      TabIndex        =   10
      Top             =   1560
      Width           =   3855
   End
   Begin VB.TextBox Text2 
      DataSource      =   "Adodc1"
      Enabled         =   0   'False
      Height          =   270
      Left            =   1680
      TabIndex        =   9
      Top             =   1080
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      DataSource      =   "Adodc1"
      Enabled         =   0   'False
      Height          =   270
      Left            =   1680
      TabIndex        =   8
      Top             =   600
      Width           =   1215
   End
   Begin VB.ComboBox Combo1 
      DataSource      =   "Adodc1"
      Height          =   300
      ItemData        =   "s_choice_frm.frx":0004
      Left            =   1680
      List            =   "s_choice_frm.frx":0006
      Style           =   2  'Dropdown List
      TabIndex        =   7
      Top             =   120
      Width           =   1215
   End
   Begin VB.Label Label10 
      Caption         =   "该门课由以下教师任教"
      Height          =   255
      Left            =   4680
      TabIndex        =   21
      Top             =   3720
      Width           =   2415
   End
   Begin VB.Label Label9 
      Caption         =   "请选择你要选修的课"
      Height          =   255
      Left            =   4680
      TabIndex        =   15
      Top             =   2280
      Width           =   2295
   End
   Begin VB.Label Label8 
      Caption         =   "已经选修的教师编号与课程名称"
      Height          =   255
      Left            =   240
      TabIndex        =   14
      Top             =   2280
      Width           =   3615
   End
   Begin VB.Line Line1 
      BorderWidth     =   3
      X1              =   120
      X2              =   7080
      Y1              =   2160
      Y2              =   2160
   End
   Begin VB.Label Label7 
      Caption         =   "家庭地址:"
      Height          =   255
      Left            =   3360
      TabIndex        =   6
      Top             =   1080
      Width           =   1095
   End
   Begin VB.Label Label6 
      Caption         =   "出生年月:"
      Height          =   255
      Left            =   3360
      TabIndex        =   5
      Top             =   600
      Width           =   1095
   End
   Begin VB.Label Label5 
      Caption         =   "学生姓名:"
      Height          =   255
      Left            =   3360
      TabIndex        =   4
      Top             =   120
      Width           =   975
   End
   Begin VB.Label Label4 
      Caption         =   "备注:"
      Height          =   255
      Left            =   120
      TabIndex        =   3
      Top             =   1560
      Width           =   1215
   End
   Begin VB.Label Label3 
      Caption         =   "电话:"
      Height          =   255
      Left            =   120
      TabIndex        =   2
      Top             =   1080
      Width           =   1215
   End
   Begin VB.Label Label2 
      Caption         =   "性别:"
      Height          =   255
      Left            =   120
      TabIndex        =   1
      Top             =   600
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "学生学号:"
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   1095
   End
End
Attribute VB_Name = "s_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 tno As String
Dim cname As String
Dim teacherno As String

Private Sub Combo1_Click()
List1.Clear
List2.Clear

    Adodc1.Recordset.MoveFirst

Do While Not Adodc1.Recordset.EOF
If Combo1.Text = Adodc1.Recordset.Fields(0) Then
    'Adodc1.Recordset.Move
    Text4 = Adodc1.Recordset.Fields(1)
    Text1 = Adodc1.Recordset.Fields(2)
    Text5 = Adodc1.Recordset.Fields(3)
    Text2 = Adodc1.Recordset.Fields(4)
    Text6 = Adodc1.Recordset.Fields(5)
    Text3 = Adodc1.Recordset.Fields(6)
    Exit Do
    
End If
Adodc1.Recordset.MoveNext
Loop
Adodc2.Recordset.MoveFirst

    Do While Not Adodc2.Recordset.EOF
        If Adodc2.Recordset.Fields(1) = Combo1.Text Then
            cno = Adodc2.Recordset.Fields(2)
            List1.AddItem Adodc2.Recordset.Fields(3)
            
            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

            List2.AddItem cname
        End If
        Adodc2.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)
            Exit Do
        End If
     
        course.Recordset.MoveNext
      Loop
    List3.Clear
    course_teacher.Recordset.MoveFirst
    Do While Not course_teacher.Recordset.EOF
       If course_teacher.Recordset.Fields(2) = cno Then
         teacherno = course_teacher.Recordset.Fields(1)
           'List3.AddItem course_teacher.Recordset.Fields(1)
           Exit Do
       End If
        course_teacher.Recordset.MoveNext
    Loop
      teacherinfo.Recordset.MoveFirst
     Do While Not teacherinfo.Recordset.EOF
          If teacherinfo.Recordset.Fields(0) = teacherno Then
            List3.AddItem teacherinfo.Recordset.Fields(1)
          End If
       teacherinfo.Recordset.MoveNext
     Loop
End Sub

Private Sub Command1_Click()

List1.AddItem tno
List3.RemoveItem List3.ListIndex
List2.AddItem Combo2.Text
Combo2.RemoveItem Combo2.ListIndex
Command3.Enabled = True
Command1.Enabled = False
End Sub

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

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

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

    myrs.Fields(1) = Combo1.Text
    myrs.Fields(2) = cno
    myrs.Fields(3) = tno
    myrs.Fields(4) = Time

    myrs.Update     '调用Recordset对象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

Private Sub List3_Click()
    teacherinfo.Recordset.MoveFirst
    Do While Not teacherinfo.Recordset.EOF
        If List3.Text = teacherinfo.Recordset.Fields(1) Then
            tno = teacherinfo.Recordset.Fields(0)
            
        End If
        teacherinfo.Recordset.MoveNext
    Loop

End Sub

⌨️ 快捷键说明

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