📄 frmlookfor.frm
字号:
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 285
Left = 4365
TabIndex = 11
Top = 2730
Visible = 0 'False
Width = 1500
End
Begin VB.Label LabKeMu
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "h"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 300
Left = 5775
TabIndex = 10
Top = 2745
Visible = 0 'False
Width = 180
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "以下为你参加过"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 300
Left = 240
TabIndex = 9
Top = 840
Width = 2220
End
Begin VB.Label Labtesttime
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "2006-05-21"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 315
Left = 6990
TabIndex = 7
Top = 4440
Width = 1800
End
Begin VB.Label Labscore
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "100"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 315
Left = 5730
TabIndex = 6
Top = 3555
Width = 555
End
Begin VB.Label Labzscore
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "100"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 315
Left = 9435
TabIndex = 5
Top = 3540
Width = 555
End
Begin VB.Label Label10
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "考试时间:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 285
Left = 5610
TabIndex = 4
Top = 4440
Width = 1515
End
Begin VB.Label Labtesttitle
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "hhhh"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 300
Left = 4230
TabIndex = 3
Top = 1785
Width = 675
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "试卷得分:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 285
Index = 1
Left = 4350
TabIndex = 2
Top = 3540
Width = 1515
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "试卷总分:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 285
Left = 7950
TabIndex = 1
Top = 3540
Width = 1515
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "试卷标题:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 285
Left = 4350
TabIndex = 0
Top = 1470
Width = 1515
End
End
Attribute VB_Name = "FrmLookFor"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'定义一个数组来保存对应试卷的id
Dim TestIDArr() As Long
Dim KeMuIDArr() As Long
Dim NianJiIDarr() As Long
Private Sub Command3_Click()
End Sub
Private Sub Form_Load()
Dim i As Integer
'添加LIST选项
Dim adoRS As Recordset
Set adoRS = New Recordset
adoRS.CursorLocation = adUseClient
adoRS.Open "select score.id,test.title from score,test where score.complete='T' and score.testid=test.id and score.studentid=" & StudentID, ConnString, adOpenStatic, adLockOptimistic
If Not adoRS.EOF Then
adoRS.MoveLast
adoRS.MoveFirst
ReDim TestIDArr(adoRS.RecordCount) As Long
For i = 0 To adoRS.RecordCount - 1
List1.AddItem adoRS.Fields(1).Value
TestIDArr(i) = adoRS.Fields(0).Value
adoRS.MoveNext
Next i
End If
adoRS.Close
'年级
adoRS.Open "select id,name from nianji", ConnString, adOpenStatic, adLockOptimistic
CmbNianJI.AddItem "所有年级"
If Not adoRS.EOF Then
adoRS.MoveLast
adoRS.MoveFirst
ReDim NianJiIDarr(adoRS.RecordCount) As Long
For i = 0 To adoRS.RecordCount - 1
CmbNianJI.AddItem adoRS.Fields("name").Value
NianJiIDarr(i) = adoRS.Fields("id").Value
adoRS.MoveNext
Next i
End If
adoRS.Close
'科目
adoRS.Open "kemu", ConnString, adOpenStatic, adLockOptimistic
CmbKeMu.AddItem "所有科目"
If Not adoRS.EOF Then
adoRS.MoveLast
adoRS.MoveFirst
ReDim KeMuIDArr(adoRS.RecordCount) As Long
For i = 0 To adoRS.RecordCount - 1
CmbKeMu.AddItem adoRS.Fields("name").Value
KeMuIDArr(i) = adoRS.Fields("id").Value
adoRS.MoveNext
Next i
End If
Set adoRS = Nothing
'List1.ListIndex = 0
'=====提示没做过任何试卷
'初始化处理
CmbCZS.ListIndex = 0
CmbKeMu.ListIndex = 0
CmbNianJI.ListIndex = 0
End Sub
Private Sub Image1_Click()
Unload Me
End Sub
Private Sub Image2_Click()
If List1.ListIndex < 0 Then
MsgBox "你还没有选择要浏览的试卷!"
Exit Sub
End If
'生成HTML文件
CreateHTML App.Path + "\temp.html", TestIDArr(List1.ListIndex)
FrmView.Web.Navigate App.Path + "\temp.html"
FrmView.Show 1
End Sub
Private Sub ImgSeach_Click()
Dim adoRS As Recordset
'定义查询条件,保存各个查询条件
Dim SqlScore As String
Dim SqlTitle As String
Dim SqlDay As String
Dim SqlKeMu As String
Dim SqlNianJI As String
Dim sql As String
Dim i As Integer
Set adoRS = New Recordset
adoRS.CursorLocation = adUseClient
'设置试卷标题
If TXTTitle.Text <> "" Then
SqlTitle = " and test.title like '%" + TXTTitle.Text + "%'"
Else
SqlTitle = ""
End If
'设置分数
If TXTScore.Text <> "" Then
SqlScore = " and score.score" + CmbCZS.Text + TXTScore.Text
Else
SqlScore = ""
End If
'设置考试日期
If CheDay.Value = 1 Then
SqlDay = " and score.testtime>='" + Date2Str(DTPS.Value) + "' and score.testtime<='" + Date2Str(DTPE.Value) + "'"
Else
SqlDay = ""
End If
'设置年级
If CmbNianJI.ListIndex = 0 Then
SqlNianJI = ""
Else
SqlNianJI = " and test.nianjiid=" & NianJiIDarr(CmbNianJI.ListIndex - 1)
End If
'设置科目
If CmbKeMu.ListIndex = 0 Then
SqlKeMu = ""
Else
SqlKeMu = " and test.kemuid=" & KeMuIDArr(CmbKeMu.ListIndex - 1)
End If
'==========================================
sql = "select test.title,score.id from test,score where test.id=score.testid and score.complete='T'"
sql = sql + SqlDay + SqlKeMu + SqlNianJI + SqlTitle + SqlScore
adoRS.Open sql, ConnString, adOpenStatic, adLockOptimistic
List1.Clear
If Not adoRS.EOF Then
adoRS.MoveLast
adoRS.MoveFirst
ReDim TestIDArr(adoRS.RecordCount) As Long
For i = 0 To adoRS.RecordCount - 1
List1.AddItem adoRS.Fields(0).Value
TestIDArr(i) = adoRS.Fields(1).Value
adoRS.MoveNext
Next i
End If
Set adoRS = Nothing
End Sub
Private Sub List1_Click()
Dim ScoreRs As Recordset
Set ScoreRs = New Recordset
ScoreRs.CursorLocation = adUseClient
ScoreRs.Open "select test.title,kemu.name,nianji.name,score.score,test.zscore,score.testtime from score,test,kemu,nianji where score.testid=test.id and test.kemuid=kemu.id and test.nianjiid=nianji.id and score.studentid=" & StudentID & " and score.id=" + Str(TestIDArr(List1.ListIndex)), ConnString, adOpenStatic, adLockOptimistic
Labtesttitle.Caption = ScoreRs.Fields(0).Value
LabKeMu.Caption = ScoreRs.Fields(1).Value
LabNianJi.Caption = ScoreRs.Fields(2).Value
Labzscore.Caption = ScoreRs.Fields(4).Value
Labscore.Caption = ScoreRs.Fields(3).Value
Labtesttime.Caption = ScoreRs.Fields(5).Value
Set ScoreRs = Nothing
End Sub
Function Date2Str(ByVal DT As Date) As String '日期转化成字符
Dim DateStr As String
DateStr = Format(DT, "YYYY-MM-DD")
Date2Str = DateStr
End Function
Private Sub TXTScore_KeyPress(KeyAscii As Integer)
If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 46) Then
KeyAscii = 0
End If
End Sub
Private Sub TXTTitle_KeyPress(KeyAscii As Integer)
If KeyAscii = 39 Then KeyAscii = -24145
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -