www.pudn.com > myActivebart.rar > Sel.frm
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form6
Caption = "查询学生成绩"
ClientHeight = 5790
ClientLeft = 60
ClientTop = 345
ClientWidth = 9210
Icon = "Sel.frx":0000
LinkTopic = "Form6"
ScaleHeight = 5790
ScaleWidth = 9210
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Caption = "查询条件"
Height = 1215
Left = 180
TabIndex = 3
Top = 150
Width = 9015
Begin VB.ComboBox Combo4
Height = 300
ItemData = "Sel.frx":08CA
Left = 7230
List = "Sel.frx":08D4
TabIndex = 15
Top = 690
Width = 1515
End
Begin VB.CheckBox Check5
Caption = "考试类型"
Height = 315
Left = 5940
TabIndex = 14
Top = 690
Width = 1185
End
Begin VB.ComboBox Combo3
Height = 300
ItemData = "Sel.frx":08E4
Left = 3870
List = "Sel.frx":08EE
TabIndex = 13
Top = 720
Width = 1785
End
Begin VB.TextBox Text2
Height = 315
Left = 1230
TabIndex = 12
Top = 660
Width = 1515
End
Begin VB.CheckBox Check4
Caption = "学期"
Height = 345
Left = 3000
TabIndex = 11
Top = 690
Width = 675
End
Begin VB.CheckBox Check3
Caption = "学年度"
Height = 345
Left = 270
TabIndex = 10
Top = 660
Width = 1035
End
Begin VB.ComboBox Combo2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 7230
TabIndex = 9
Top = 210
Width = 1515
End
Begin VB.CheckBox Check2
Caption = "科目"
Height = 315
Left = 5910
TabIndex = 8
Top = 210
Width = 855
End
Begin VB.CheckBox Check1
Caption = "学号"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 2940
TabIndex = 7
Top = 210
Width = 795
End
Begin VB.TextBox Text1
Height = 315
Left = 3810
TabIndex = 6
Top = 210
Width = 1815
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1230
TabIndex = 4
Top = 180
Width = 1515
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "选择班级:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 150
TabIndex = 5
Top = 270
Width = 1020
End
End
Begin MSFlexGridLib.MSFlexGrid grid1
Height = 3615
Left = 210
TabIndex = 2
Top = 1440
Width = 8925
_ExtentX = 15743
_ExtentY = 6376
_Version = 393216
Rows = 100
Cols = 8
FixedCols = 0
BackColor = -2147483624
FormatString = " 班级 | 学号 | 姓名 |学期| 学年度 | 科目 | 考试类型 | 成绩 "
End
Begin VB.CommandButton Command3
Caption = "退出(&Q)"
Height = 375
Left = 8250
TabIndex = 1
Top = 5310
Width = 885
End
Begin VB.CommandButton Command2
Caption = "查询(&S)"
Height = 375
Left = 7290
TabIndex = 0
Top = 5310
Width = 975
End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As New ADODB.Recordset
Dim strsql As String
Private Sub Command2_Click()
On Error GoTo error:
strsql = "select * from 学生在校成绩 where 班级 = '" & Combo1.Text & "'"
If Check1.Value Then strsql = strsql + " and 学号 = '" & Text1.Text & "'"
If Check2.Value Then strsql = strsql + " and 科目 = '" & Combo2.Text & "'"
If Check3.Value Then strsql = strsql + " and 学年度 = '" & Text2.Text & "'"
If Check4.Value Then strsql = strsql + " and 学期 = '" & Combo3.Text & "'"
If Check5.Value Then strsql = strsql + " and 考试类型= '" & Combo4.Text & "'"
If rs.State = 1 Then rs.Close
rs.Open strsql, cnn, adOpenKeyset, adLockPessimistic
Call grade1(rs, grid1)
Exit Sub
error:
MsgBox Err.Description
End Sub
Private Sub Command3_Click()
Unload Form6
End Sub
Private Sub Form_Load()
If rs.State = 1 Then rs.Close
rs.Open "select 班级 from 班级表", cnn, adOpenKeyset, adLockPessimistic
If rs.RecordCount <> 0 Then
rs.MoveFirst
Do While Not rs.EOF
Combo1.additem rs.Fields("班级")
rs.MoveNext
Loop
End If
If rs.State = 1 Then rs.Close
rs.Open "select 科目 from 科目表", cnn, adOpenKeyset, adLockPessimistic
If rs.RecordCount <> 0 Then
rs.MoveFirst
Do While Not rs.EOF
Combo2.additem rs.Fields("科目")
rs.MoveNext
Loop
End If
End Sub