📄 form7.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "msadodc.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Form7
Caption = "Form7"
ClientHeight = 4905
ClientLeft = 60
ClientTop = 345
ClientWidth = 6630
LinkTopic = "Form7"
ScaleHeight = 4905
ScaleWidth = 6630
StartUpPosition = 3 '窗口缺省
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 480
Top = 4440
Width = 2895
_ExtentX = 5106
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 2175
Left = 360
TabIndex = 13
Top = 2160
Width = 5895
_ExtentX = 10398
_ExtentY = 3836
_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
Begin VB.OptionButton Option1
Caption = "高于分数线"
Height = 255
Index = 2
Left = 3120
TabIndex = 10
Top = 1080
Value = -1 'True
Width = 1335
End
Begin VB.OptionButton Option1
Caption = "低于分数线"
Height = 255
Index = 3
Left = 4560
TabIndex = 9
Top = 1080
Width = 1335
End
Begin VB.Frame Frame1
Caption = "查询条件"
Height = 1815
Left = 240
TabIndex = 0
Top = 240
Width = 6015
Begin VB.CommandButton Command2
Caption = "关闭"
Height = 375
Left = 4560
TabIndex = 12
Top = 1320
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 2880
TabIndex = 11
Top = 1320
Width = 1215
End
Begin VB.TextBox Text2
Height = 270
Left = 4200
TabIndex = 8
Text = "60"
Top = 360
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Left = 1080
TabIndex = 7
Top = 1320
Width = 1575
End
Begin VB.CheckBox Check4
Caption = "及格分数"
Height = 255
Left = 2880
TabIndex = 6
Top = 360
Width = 1095
End
Begin VB.CheckBox Check3
Caption = "学号"
Height = 255
Left = 240
TabIndex = 5
Top = 1320
Width = 735
End
Begin VB.ComboBox Combo2
Height = 300
Left = 1080
TabIndex = 4
Top = 840
Width = 1575
End
Begin VB.CheckBox Check2
Caption = "科目"
Height = 255
Left = 240
TabIndex = 3
Top = 840
Width = 735
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1080
TabIndex = 2
Top = 360
Width = 1575
End
Begin VB.CheckBox Check1
Caption = "班级"
Height = 255
Left = 240
TabIndex = 1
Top = 360
Width = 735
End
End
End
Attribute VB_Name = "Form7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public conn As New ADODB.Connection
Public rs As New ADODB.Recordset
Private Sub Combo1_Click()
Dim sql As String
sql = "select * from 成绩科目 where 班级ID = '" & Combo1.Text & "'"
rs.Open sql, conn
Do While Not rs.EOF
Combo2.AddItem (rs("成绩科目"))
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Sub
Private Sub Command1_Click()
sql = "select * from 学生成绩 where true "
If Check1.Value = 1 Then
sql = sql & " and 班级ID = '" & Combo1.Text & "'"
End If
If Check2.Value = 1 Then
sql = sql & " and 科目ID = '" & Combo2.Text & "'"
End If
If Check3.Value = 1 Then
sql = sql & " and 学生ID = " & Text1.Text & ""
End If
If Check4.Value = 1 Then
If Option1(2).Value = True Then
sql = sql & " and 成绩 >=" & Val(Text2.Text)
End If
If Option1(3).Value = True Then
sql = sql & " and 成绩 <" & Val(Text2.Text)
End If
End If
Adodc1.RecordSource = sql
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
Adodc1.Tag = 0
'Label1.Caption = sql
End Sub
Private Sub Command2_Click()
Me.Hide
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\student.mdb;Persist Security Info=False"
Adodc1.CommandType = adCmdText
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\student.mdb;Persist Security Info=False"
conn.Open
rs.Open "select * from 班级", conn
Do While Not rs.EOF
Combo1.AddItem (rs("班级"))
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -