frmInquireresult.frm
上传用户:rocksue
上传日期:2013-06-17
资源大小:41926k
文件大小:9k
- VERSION 5.00
- Begin VB.Form frmInquireresult
- Caption = "查询成绩信息"
- ClientHeight = 5325
- ClientLeft = 45
- ClientTop = 345
- ClientWidth = 8070
- LinkTopic = "Form1"
- MDIChild = -1 'True
- ScaleHeight = 5325
- ScaleWidth = 8070
- Begin VB.Frame Frame1
- Caption = "查询"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1932
- Left = 120
- TabIndex = 0
- Top = 3240
- Width = 7812
- Begin VB.CheckBox Check1
- Caption = "按学号:"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 252
- Index = 0
- Left = 120
- TabIndex = 8
- Top = 360
- Width = 1212
- End
- Begin VB.CheckBox Check1
- Caption = "按姓名:"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 252
- Index = 1
- Left = 2640
- TabIndex = 7
- Top = 360
- Width = 1212
- End
- Begin VB.CheckBox Check1
- Caption = "按课程:"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 252
- Index = 2
- Left = 5280
- TabIndex = 6
- Top = 360
- Width = 1212
- End
- Begin VB.CommandButton cmdInquire
- Caption = "查询"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 1680
- TabIndex = 5
- Top = 1080
- Width = 1212
- End
- Begin VB.CommandButton cmdExit
- Caption = "退出查询"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 3960
- TabIndex = 4
- Top = 1080
- Width = 1212
- End
- Begin VB.TextBox txtSID
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 372
- Left = 1320
- TabIndex = 3
- Top = 360
- Width = 1092
- End
- Begin VB.TextBox txtName
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 372
- Left = 3840
- TabIndex = 2
- Top = 360
- Width = 1092
- End
- Begin VB.TextBox txtCourse
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 372
- Left = 6480
- TabIndex = 1
- Top = 360
- Width = 1092
- End
- End
- Begin VB.PictureBox myflexgrid
- BeginProperty Font
- Name = "宋体"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 3012
- Left = 0
- ScaleHeight = 2955
- ScaleWidth = 7875
- TabIndex = 9
- Top = 0
- Width = 7932
- End
- End
- Attribute VB_Name = "frmInquireresult"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub cmdExit_Click()
- Unload Me
-
- End Sub
- Private Sub cmdInquire_Click()
- Dim txtSQL As String
- Dim MsgText As String
- Dim dd(4) As Boolean
- Dim mrc As ADODB.Recordset
-
-
- txtSQL = "select * from result_Info where "
- If Check1(0).Value Then
- If Trim(txtSID.Text) = "" Then
- sMeg = "学号不能为空"
- MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
- txtSID.SetFocus
- Exit Sub
- Else
- If Not IsNumeric(Trim(txtSID.Text)) Then
- MsgBox "请输入数字!", vbOKOnly + vbExclamation, "警告"
- Exit Sub
- txtSID.SetFocus
- End If
- dd(0) = True
- txtSQL = txtSQL & "student_ID = '" & Trim(txtSID.Text) & "'"
- End If
- End If
-
- If Check1(1).Value Then
- If Trim(txtName.Text) = "" Then
- sMeg = "姓名不能为空"
- MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
- txtName.SetFocus
- Exit Sub
- Else
- dd(1) = True
- If dd(0) Then
- txtSQL = txtSQL & "and student_Name = '" & txtName.Text & "'"
- Else
- txtSQL = txtSQL & "student_Name = '" & txtName.Text & "'"
- End If
- End If
- End If
-
- If Check1(2).Value Then
- If Trim(txtCourse.Text) = "" Then
- sMeg = "课程不能为空"
- MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
- txtCourse.SetFocus
- Exit Sub
- Else
- dd(2) = True
- If dd(0) Or dd(1) Then
- txtSQL = txtSQL & "and course_Name = '" & txtCourse.Text & "'"
- Else
- txtSQL = txtSQL & "course_Name = '" & txtCourse.Text & "'"
- End If
- End If
- End If
-
- If Not (dd(0) Or dd(1) Or dd(2) Or dd(3)) Then
- MsgBox "请设置查询方式!", vbOKOnly + vbExclamation, "警告"
- Exit Sub
- End If
-
- txtSQL = txtSQL & " order by student_ID "
- Set mrc = ExecuteSQL(txtSQL, MsgText)
-
- With myflexgrid
- .Rows = 2
- .CellAlignment = 4
- .TextMatrix(1, 0) = "考试编号"
- .TextMatrix(1, 1) = "学号"
- .TextMatrix(1, 2) = "姓名"
- .TextMatrix(1, 3) = "班号"
- .TextMatrix(1, 4) = "课程名称"
- .TextMatrix(1, 5) = "分数"
-
-
- Do While Not mrc.EOF
- .Rows = .Rows + 1
- .CellAlignment = 4
- .TextMatrix(.Rows - 1, 0) = mrc.Fields(0)
- .TextMatrix(.Rows - 1, 1) = mrc.Fields(1)
- .TextMatrix(.Rows - 1, 2) = mrc.Fields(2)
- .TextMatrix(.Rows - 1, 3) = mrc.Fields(3)
- .TextMatrix(.Rows - 1, 4) = mrc.Fields(4)
- .TextMatrix(.Rows - 1, 5) = mrc.Fields(5)
- mrc.MoveNext
- Loop
-
- End With
-
- mrc.Close
- End Sub
- Private Sub Form_Load()
- With myflexgrid
- .CellAlignment = 4
- .TextMatrix(1, 0) = "考试编号"
- .TextMatrix(1, 1) = "学号"
- .TextMatrix(1, 2) = "姓名"
- .TextMatrix(1, 3) = "班号"
- .TextMatrix(1, 4) = "课程名称"
- .TextMatrix(1, 5) = "分数"
-
- End With
- End Sub