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

📄 frmselect.frm

📁 这是一个学生学籍管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         _ExtentY        =   3201
         _Version        =   393216
         HeadLines       =   1
         RowHeight       =   15
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   2
         BeginProperty Column00 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
            EndProperty
            BeginProperty Column01 
            EndProperty
         EndProperty
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "学生信息"
      Height          =   975
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   9735
      Begin VB.TextBox txbGrade 
         Height          =   375
         Left            =   4680
         TabIndex        =   6
         Top             =   360
         Width           =   975
      End
      Begin VB.TextBox txbName 
         Height          =   375
         Left            =   2880
         TabIndex        =   4
         Top             =   360
         Width           =   975
      End
      Begin VB.TextBox txbId 
         Height          =   375
         Left            =   600
         TabIndex        =   2
         Top             =   360
         Width           =   1575
      End
      Begin VB.Label Label4 
         Caption         =   "这里输入学号后回车,正常操作是学生用自己的学号登陆到系统,只能选择自己的课程。因为系统没有制作登陆功能,所以这么处理。"
         Height          =   615
         Left            =   5880
         TabIndex        =   7
         Top             =   240
         Width           =   3735
      End
      Begin VB.Label Label3 
         Caption         =   "班级"
         Height          =   255
         Left            =   4200
         TabIndex        =   5
         Top             =   480
         Width           =   495
      End
      Begin VB.Label Label2 
         Caption         =   "姓名"
         Height          =   255
         Left            =   2520
         TabIndex        =   3
         Top             =   480
         Width           =   615
      End
      Begin VB.Label Label1 
         Caption         =   "学号"
         Height          =   255
         Left            =   120
         TabIndex        =   1
         Top             =   480
         Width           =   615
      End
   End
End
Attribute VB_Name = "frmSelect"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub SetGrdSubject()
    '根据查询条件组合SQL语句
    Dim strSQL As String
    strSQL = "select a.课序号,b.课程编号,b.课程名称,b.教师,"
    strSQL = strSQL + "b.开课系别,a.上课时间天,a.上课时间节,a.上课地点 from 课程表"
    strSQL = strSQL + " as a, 课程信息 as b where a.课程编号=b.课程编号"
    Dim strFilter As String
    strFilter = ""
    If Len(Trim(Me.txbPY.Text)) <> 0 Then
        strFilter = strFilter + " and 拼音码 like '" + Trim(Me.txbPY.Text) + "%'"
    End If
    If Len(Trim(Me.txbCName.Text)) <> 0 Then
        strFilter = strFilter + " and 课程名称 like '" + Trim(txbCName.Text) + "%'"
    End If
    If Len(Trim(Me.txbCId.Text)) <> 0 Then
        strFilter = strFilter + " and b.课程编号 like '" + Trim(Me.txbCId.Text) + "%'"
    End If
    If Len(Trim(Me.txbCNumber.Text)) <> 0 Then
        strFilter = strFilter + " and 课序号 like '" + Trim(Me.txbCNumber.Text) + "%'"
    End If
    If Len(Trim(strFilter)) = 0 Then
        Exit Sub
    End If
    strFilter = strFilter + " order by 课序号"
    '执行SQL语句
    Dim db As New DataBases
    Dim rs As Recordset
    Set rs = db.RunSelectSQL(strSQL + strFilter)
    '设置数据源
    Set Adodc2.Recordset = rs
End Sub


Private Sub btnDelete_Click()
    If Adodc1.Recordset.EOF Or Adodc1.Recordset.BOF Then
        Exit Sub
    End If
    If MsgBox("你确定要删除吗?", vbYesNo) = vbYes Then
        Dim strCId As String
        strCId = Trim(Adodc1.Recordset(1))
        Dim strSQL As String
        strSQL = "delete from 选课表 where 学号='"
        strSQL = strSQL + Trim(Me.txbId.Text)
        strSQL = strSQL + "' and 课序号 = '" + strCId + "'"
        Dim db As New DataBases
        db.RunSelectSQL (strSQL)
        Dim rs As Recordset
        strSQL = "select c.学号,a.课序号,b.课程名称,b.教师,b.开课系别,"
        strSQL = strSQL + "a.上课时间天,a.上课时间节,a.上课地点 from 选课表 "
        strSQL = strSQL + "as c, 课程表 as a, 课程信息 as b where "
        strSQL = strSQL + "a.课程编号=b.课程编号 and c.课序号=a.课序号 "
        strSQL = strSQL + "and 学号='" + Trim(txbId.Text) + "' order by a.课序号"
        Set rs = db.RunSelectSQL(strSQL)
        Set Adodc1.Recordset = rs
    End If
End Sub

Private Sub btnDisplay_Click()
    Dim frm As New frmCourse
    frm.txbOne.Text = Me.txbId.Text
    frm.LoadData
    frm.Show
End Sub

Private Sub btnSearch_Click()
    SetGrdSubject
End Sub

Private Sub btnSelect_Click()
    If Adodc2.Recordset.EOF Or Adodc2.Recordset.BOF Then
        Exit Sub
    End If
    Dim db As New DataBases
    Dim rs As Recordset
    Dim strSQL As String
    Dim strTmp As String
    strTmp = Trim(Adodc2.Recordset(1))
    strSQL = "select * from 选课表 where 学号='" + Trim(txbId.Text)
    strSQL = strSQL + "' and 课序号 in(select 课序号 from 课程表 where 课程编号='"
    strSQL = strSQL + strTmp + "')"
    Set rs = db.RunSelectSQL(strSQL)
    If rs.RecordCount <> 0 Then
        MsgBox ("该课程已经选择!")
        db.CloseConn
        Exit Sub
    End If
    Dim strCId As String
    strCId = Trim(Adodc2.Recordset(0))
    strSQL = "select * from 选课表 as a, 课程表 as b "
    strSQL = strSQL + "where a.课序号=b.课序号 and a.学号='"
    strSQL = strSQL + Trim(txbId.Text) + "' and  100*b.上课时间天+"
    strSQL = strSQL + "b.上课时间节 in (select 100*上课时间天+上课时间节"
    strSQL = strSQL + " from 课程表 where 课序号='" + strCId + "')"
    Set rs = db.RunSelectSQL(strSQL)
    If rs.RecordCount <> 0 Then
        MsgBox ("该课序号时间和已经选择的课程冲突!")
        Exit Sub
    Else
        strSQL = "insert into 选课表(学号,课序号) values('"
        strSQL = strSQL + Trim(txbId.Text) + "','" + strCId + " ')"
        db.RunSelectSQL (strSQL)
        strSQL = "select c.学号,a.课序号,b.课程名称,b.教师,b.开课系别,"
        strSQL = strSQL + "a.上课时间天,a.上课时间节,a.上课地点 from 选课表 "
        strSQL = strSQL + "as c, 课程表 as a, 课程信息 as b where "
        strSQL = strSQL + "a.课程编号=b.课程编号 and c.课序号=a.课序号 and 学号='"
        strSQL = strSQL + Trim(txbId.Text) + "' order by a.课序号"
        Set rs = db.RunSelectSQL(strSQL)
        Set Adodc1.Recordset = rs
    End If
End Sub

Private Sub Form_Load()
    Dim db As New DataBases
    Adodc1.ConnectionString = db.sConn
    Adodc2.ConnectionString = db.sConn
    SetGrdSubject
End Sub

Private Sub txbPY_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SetGrdSubject
    End If
End Sub

Private Sub txbCName_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SetGrdSubject
    End If
End Sub

Private Sub txbCId_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SetGrdSubject
    End If
End Sub

Private Sub txbCNumber_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SetGrdSubject
    End If
End Sub

Private Sub txbId_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        Dim db As New DataBases
        Dim strSQL As String
        strSQL = "select 姓名, 班级名称, 学籍编号 from 学生信息 as a,"
        strSQL = strSQL + " 班级信息 as b where a.班级编号=b.班级编号 "
        strSQL = strSQL + "and 学号='" + Trim(Me.txbId.Text) + "'"
        Dim rs As Recordset
        Set rs = db.RunSelectSQL(strSQL)
        If rs.RecordCount = 0 Then
            MsgBox ("不是在籍的学生")
            Me.txbId.Text = ""
        Else
            Me.txbName.Text = Trim(rs("姓名"))
            Me.txbGrade.Text = Trim(rs("班级名称"))
        End If
        strSQL = "select c.学号,a.课序号,b.课程名称,b.教师,b.开课系别,"
        strSQL = strSQL + "a.上课时间天,a.上课时间节,a.上课地点 from 选课表 "
        strSQL = strSQL + "as c, 课程表 as a, 课程信息 as b where a.课程编号 "
        strSQL = strSQL + "=b.课程编号 and c.课序号=a.课序号 and 学号='"
        strSQL = strSQL + Trim(txbId.Text)
        strSQL = strSQL + "' order by a.课序号"
        Set rs = db.RunSelectSQL(strSQL)
        Set Adodc1.Recordset = rs
    End If
End Sub

⌨️ 快捷键说明

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