📄 resultform.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form resultForm
BorderStyle = 1 'Fixed Single
Caption = "成绩录入"
ClientHeight = 8025
ClientLeft = 45
ClientTop = 330
ClientWidth = 8820
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 8025
ScaleWidth = 8820
Begin VB.Frame Frame2
Caption = "成绩浏览框"
Height = 5295
Left = 120
TabIndex = 1
Top = 2520
Width = 8535
Begin MSFlexGridLib.MSFlexGrid MSF
Height = 4815
Left = 120
TabIndex = 15
Top = 360
Width = 8295
_ExtentX = 14631
_ExtentY = 8493
_Version = 393216
SelectionMode = 1
End
End
Begin VB.Frame Frame1
Caption = "成绩录入框"
Height = 2295
Left = 120
TabIndex = 0
Top = 120
Width = 8535
Begin VB.CommandButton saveBnt
Caption = "保存"
Height = 375
Left = 3000
TabIndex = 14
Top = 1680
Width = 2295
End
Begin VB.TextBox txtResult
Height = 375
Left = 6240
TabIndex = 13
Top = 960
Width = 1695
End
Begin VB.TextBox txtRank
Height = 375
Left = 3360
TabIndex = 11
Top = 960
Width = 1695
End
Begin VB.TextBox txtPrj
Enabled = 0 'False
Height = 375
Left = 840
TabIndex = 9
Top = 960
Width = 1455
End
Begin VB.TextBox txtName
Enabled = 0 'False
Height = 375
Left = 6240
TabIndex = 7
Top = 240
Width = 1695
End
Begin VB.TextBox txtSNo
Enabled = 0 'False
Height = 375
Left = 3360
TabIndex = 5
Top = 240
Width = 1695
End
Begin VB.TextBox txtNo
Enabled = 0 'False
Height = 375
Left = 840
TabIndex = 3
Top = 240
Width = 1455
End
Begin VB.Label Label6
Caption = "成绩:"
Height = 255
Left = 5640
TabIndex = 12
Top = 1080
Width = 855
End
Begin VB.Label Label5
Caption = "名次:"
Height = 255
Left = 2760
TabIndex = 10
Top = 1080
Width = 735
End
Begin VB.Label Label4
Caption = "项目:"
Height = 255
Left = 240
TabIndex = 8
Top = 1080
Width = 855
End
Begin VB.Label Label3
Caption = "姓名:"
Height = 255
Left = 5640
TabIndex = 6
Top = 360
Width = 1095
End
Begin VB.Label Label2
Caption = "学号:"
Height = 255
Left = 2760
TabIndex = 4
Top = 360
Width = 1095
End
Begin VB.Label Label1
Caption = "序号:"
Height = 255
Left = 240
TabIndex = 2
Top = 360
Width = 1095
End
End
End
Attribute VB_Name = "resultForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Sub classshowtitle()
Dim i As Integer
MSF.Clear
With MSF
.Cols = 10
.TextMatrix(0, 1) = "序号"
.TextMatrix(0, 2) = "学号"
.TextMatrix(0, 3) = "姓名"
.TextMatrix(0, 4) = "性别"
.TextMatrix(0, 5) = "班级"
.TextMatrix(0, 6) = "项目"
.TextMatrix(0, 7) = "名次"
.TextMatrix(0, 8) = "成绩"
.TextMatrix(0, 9) = "积分"
.ColWidth(0) = 100
.ColWidth(1) = 1300
.ColWidth(2) = 1200
.ColWidth(3) = 1200
.ColWidth(4) = 1500
.ColWidth(5) = 1500
.ColWidth(6) = 1500
.ColWidth(7) = 1500
.ColWidth(8) = 1500
.FixedRows = 1
For i = 1 To 9
.ColAlignment(i) = 0
Next i
.FillStyle = flexFillSingle
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 4
.Row = 1
End With
End Sub
Public Sub classshowdata()
Dim j As Integer
Dim i As Integer
Dim mrc1 As ADODB.Recordset
strSql = "select student_sport_id,student_info_no,student_info_name,student_info_sex,class_info_name,sport_item_name,student_sport_rank,student_sport_result,student_sport_no from student_sport,student_info,class_info,sport_item where student_info.student_info_id = student_sport.student_info_id and class_info.class_info_id = student_info.class_info_id and student_sport.sport_item_id = sport_item.sport_item_id"
Set mrc1 = ExecuteSQL(Trim(strSql))
If mrc1.EOF = False Then
mrc1.MoveFirst
With MSF
.Rows = 1
Do While Not mrc1.EOF
.Rows = .Rows + 1
For i = 1 To mrc1.Fields.Count
If mrc1.Fields(i - 1) = Null Then
.TextMatrix(.Rows - 1, i) = ""
Else
.TextMatrix(.Rows - 1, i) = mrc1.Fields(i - 1)
End If
Next i
mrc1.MoveNext
Loop
mrc1.Close
End With
End If
End Sub
Private Sub MSF_Click()
resultForm.txtNo = MSF.TextMatrix(MSF.RowSel, 1)
resultForm.txtSNo = MSF.TextMatrix(MSF.RowSel, 2)
resultForm.txtName = MSF.TextMatrix(MSF.RowSel, 3)
resultForm.txtPrj = MSF.TextMatrix(MSF.RowSel, 6)
resultForm.txtRank = MSF.TextMatrix(MSF.RowSel, 7)
resultForm.txtResult = MSF.TextMatrix(MSF.RowSel, 8)
End Sub
Private Sub saveBnt_Click()
If txtNo.Text = "" Then
MsgBox "序号不能为空!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
If txtSNo.Text = "" Then
MsgBox "学号不能为空!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
If txtName.Text = "" Then
MsgBox "姓名不能为空!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
If txtPrj.Text = "" Then
MsgBox "项目不能为空!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
If txtRank.Text = "" Then
MsgBox "名次不能为空!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
If txtResult.Text = "" Then
MsgBox "成绩不能为空!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
strSql = "select sport_item_id from sport_item where sport_item_name = '" & Trim(txtPrj.Text) & "'"
'txtResult.Text = strSql
Set rs = ExecuteSQL(strSql)
If rs.EOF = True Then
MsgBox "保存记录失败!", vbExclamation + vbOKOnly, "警告"
rs.Close
Exit Sub
Else
rs.MoveFirst
spId = rs.Fields(0)
rs.Close
End If
strSql = "select sport_scord_no from sport_scord where sport_scord_rank = " & txtRank.Text & " and sport_item_id = " & spId
Set rs1 = ExecuteSQL(strSql)
If rs1.EOF = True Then
spResult = "0"
rs1.Close
Else
rs1.MoveFirst
spResult = rs1.Fields(0)
rs1.Close
End If
strSql = "update student_sport set student_sport_rank = " & txtRank.Text & ",student_sport_no = " & spResult & ",student_sport_result = '" & txtResult.Text & "' where student_sport_id = " & Trim(txtNo.Text)
If ExecuteUpdateSQL(strSql) = False Then
MsgBox "保存记录失败!", vbExclamation + vbOKOnly, "警告"
Else
MsgBox "保存记录成功!", vbExclamation + vbOKOnly, "警告"
End If
Me.classshowdata
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -