VB学生信息管理系统论文 第5页

VB学生信息管理系统论文 第5页
Private Sub Text2_Change()

End Sub

Private Sub Text8_Change()

End Sub
课程管理:课程查询(如:界面如图三)
 (图三)
当输入查询类别、运算符和条件后可以查找到所需要的课程设置,或按查询时间来查询,输入所要查找的时间段,就可查到所要的课程设置。
代码如下:
Dim sqlstr As String

Private Sub Combo1_Change()

End Sub

Private Sub Combo2_Change()

End Sub

Private Sub Combo4_Change()

End Sub

Private Sub Combo5_Change()

End Sub

Private Sub Combo7_Change()

End Sub

Private Sub Command1_Click()
Dim a As String
Dim KCCX1 As String
Dim KCCX2 As String
Dim str1 As String
Dim str2 As String

If Option3.Value = True Then
a = Trim(Combo2)
Select Case a
    Case "="
        KCCX1 = "" & Combo1.Text & " " & Combo2.Text & " '" & Trim(Text1) & "'"
    Case "like"
        KCCX1 = "Instr(1," & Combo1.Text & ",'" & Trim(Text1.Text) & "')<>0 "
End Select
   
a = Trim(Combo4)
Select Case a
    Case "="
        KCCX2 = "" & Combo3.Text & " " & Combo4.Text & " '" & Trim(Text2) & "'"
    Case "like"
        KCCX2 = "Instr(1," & Combo3.Text & ",'" & Trim(Text2.Text) & "')<>0 "
End Select
   
If Option1.Value = True Then
    If KCCX1 = "" Then
            strTiaoJian = "select * from 课程表 where " & KCCX2
    ElseIf KCCX2 = "" Then
            strTiaoJian = "select * from 课程表 where " & KCCX1
        Else
            strTiaoJian = "select * from 课程表 where " & KCCX1 & "and " & KCCX2
    End If
ElseIf Option2.Value = True Then
    If KCCX1 = "" Then
            strTiaoJian = "select * from 课程表 where " & KCCX2
    ElseIf KCCX2 = "" Then
            strTiaoJian = "select * from 课程表 where " & KCCX1
        Else
            strTiaoJian = "select * from 课程表 where " & KCCX1 & "or " & KCCX2
    End If
Else
    If KCCX1 = "" Then
        strTiaoJian = "select * from 课程表 where " & KCCX2
    ElseIf KCCX2 = "" Then
        strTiaoJian = "select * from 课程表 where " & KCCX1
    Else
        MsgBox "请选择连接方式!", vbOKOnly, "警告"
    Exit Sub
    End If
End If
   
If (KCCX1 & KCCX2) = "" Then
    MsgBox "请输入查询类别!", vbOKOnly, "警告"
Exit Sub
Else
    Unload Me
    Frm_UpdateGrean.Show 1
End If
End If

If Option4.Value = True Then
    If Val(Combo6) > Val(Combo9) Then
        MsgBox "请正确选择年份!", vbOKOnly + vbExclamation, "信息提示"
        Combo6.SetFocus
        Exit Sub
    Else
    If Val(Combo6) = Val(Combo9) Then
        If Val(Combo7) > Val(Combo10) Then
            MsgBox "请正确选择月份!", vbOKOnly + vbExclamation, "信息提示"
            Combo7.SetFocus
            Exit Sub
        Else
            If Val(Combo7) = Val(Combo10) Then
                If Val(Combo8) > Val(Combo11) Then
                    MsgBox "请正确选择日期!", vbOKOnly + vbExclamation, "信息提示"
                    Combo8.SetFocus
                    Exit Sub
                End If
            End If
        End If
    End If
    End If

    If Combo6.Text = "" Or Combo7.Text = "" Or Combo8.Text = "" Or Combo9.Text = "" Or Combo10.Text = "" Or Combo11.Text = "" Then
        MsgBox "请输入完整的日期", vbOKOnly, "警告"
        Exit Sub
    End If
       
    str1 = Trim(Combo6) & "-" & Trim(Combo7) & "-" & Trim(Combo8)
    str2 = Trim(Combo9) & "-" & Trim(Combo10) & "-" & Trim(Combo11)
    str1 = Format(str1, "yyyy-mm-dd")
    str2 = Format(str2, "yyyy-mm-dd")
       
    If sqlstr = "" Then
        sqlstr = "" & Trim(Combo5.Text) & ">=#" & Format(str1, "yyyy-mm-dd") & "# and " & Trim(Combo5.Text) & "<= #" & Format(str2, "yyyy-mm-dd") & "#"
    Else
        sqlstr = sqlstr & " and " & Trim(Combo5.Text) & ">=#" & Format(str1, "yyyy-mm-dd") & "# and  " & Trim(Combo5.Text) & "<= #" & Format(str2, "yyyy-mm-dd") & "#"
    End If
       
    If sqlstr = "" Then
        MsgBox "请先输入查找时间!"
        Exit Sub
    End If
       
    strTiaoJian = "select 专业,年级,学期,课程名称,教材,任课老师,课时,上课地点,课程性质,考试性质 from 课程表 where " & sqlstr
    Unload Me
    Frm_UpdateGrean.Show 1
End If

If Option3.Value <> True And Option4.Value <> True Then
    MsgBox "请选择查询方式!", vbOKOnly, "警告"
    Exit Sub
End If
End SubPrivate Sub Command3_Click()
    Unload Me
End Sub

Private Sub Form_Load()
Dim i, j As Integer
For i = 1999 To 2010
    Combo6.AddItem i
    Combo9.AddItem i

上一页  [1] [2] [3] [4] [5] [6] [7] [8] 下一页

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有