📄 form9.frm
字号:
VERSION 5.00
Begin VB.Form Form9
Caption = "运动员总成绩与奖牌"
ClientHeight = 5535
ClientLeft = 60
ClientTop = 450
ClientWidth = 4335
LinkTopic = "Form9"
ScaleHeight = 5535
ScaleWidth = 4335
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "总成绩与奖牌查询"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 5295
Left = 120
TabIndex = 0
Top = 120
Width = 4095
Begin VB.CommandButton Command4
Caption = "统计总成绩"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2520
TabIndex = 14
Top = 3960
Width = 1215
End
Begin VB.ListBox List2
Height = 1320
Left = 120
TabIndex = 13
Top = 2640
Width = 1455
End
Begin VB.CommandButton Command3
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2520
TabIndex = 9
Top = 4680
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "统计金牌总数"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2520
TabIndex = 8
Top = 2880
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "统计前三名"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2520
TabIndex = 7
Top = 1560
Width = 1215
End
Begin VB.ListBox List1
Height = 1320
Left = 120
TabIndex = 2
Top = 720
Width = 1455
End
Begin VB.Label Label11
Caption = "备注: ""选择运动员号""列表中没有的运动员无金牌和总成绩!"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 975
Left = 240
TabIndex = 17
Top = 4080
Width = 1575
End
Begin VB.Label Label10
BorderStyle = 1 'Fixed Single
Height = 375
Left = 2880
TabIndex = 16
Top = 3480
Width = 855
End
Begin VB.Label Label9
Caption = "总成绩为"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1680
TabIndex = 15
Top = 3480
Width = 1095
End
Begin VB.Label Label8
BorderStyle = 1 'Fixed Single
Height = 375
Left = 2880
TabIndex = 12
Top = 2280
Width = 855
End
Begin VB.Label Label7
Caption = "金牌总数为"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1680
TabIndex = 11
Top = 2280
Width = 1095
End
Begin VB.Label Label6
Caption = "选择运动员号"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 10
Top = 2280
Width = 1335
End
Begin VB.Label Label5
Caption = "金 银 铜"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2040
TabIndex = 6
Top = 360
Width = 1695
End
Begin VB.Label Label4
BorderStyle = 1 'Fixed Single
Height = 495
Left = 3240
TabIndex = 5
Top = 720
Width = 375
End
Begin VB.Label Label3
BorderStyle = 1 'Fixed Single
Height = 495
Left = 2640
TabIndex = 4
Top = 720
Width = 375
End
Begin VB.Label Label2
BorderStyle = 1 'Fixed Single
Height = 495
Left = 2040
TabIndex = 3
Top = 720
Width = 375
End
Begin VB.Label Label1
Caption = "统计项目选择"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 1
Top = 360
Width = 1335
End
End
End
Attribute VB_Name = "Form9"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo ErrMsg
Dim sql1 As String
Label2.Caption = ""
Label3.Caption = ""
Label4.Caption = ""
If List1.Text = "" Then
MsgBox "您没选择运动项目!", vbOKOnly + vbExclamation, "系统提示"
Exit Sub
End If
Set adors = adocon.Execute("select count(" & List1.Text & ") from 运动项目及成绩表m4119")
If adors(0) < 3 Then
MsgBox "此运动项目参加人数少于三人!无法统计.", vbOKOnly + vbExclamation, "系统提示"
List1.Text = ""
Exit Sub
End If
Set adors = adocon.Execute("select top 3 a_no4119 from 运动项目及成绩表m4119 where " & List1.Text & "!=0 order by " & List1.Text & " desc")
If adors.BOF And adors.EOF Then
MsgBox "没有找到你需要的数据!", vbOKOnly + vbExclamation, "系统提示"
Exit Sub
End If
Label2.Caption = adors(0)
adors.MoveNext
Label3.Caption = adors(0)
adors.MoveNext
Label4.Caption = adors(0)
adors.MoveNext
Set adors = adocon.Execute("select a_no4119 from 运动员成绩表4119 where a_no4119=" & Label2.Caption & "")
If adors.EOF Then
adocon.Execute ("insert into 运动员成绩表4119(a_no4119,a_results4119,a_gold4119) values(" & Label2.Caption & ",'4','1')")
Else
sql1 = "update 运动员成绩表4119 set a_results4119=a_results4119+4,a_gold4119=a_gold4119+1 where " & Label2.Caption & "=a_no4119"
adocon.Execute (sql1)
End If
Set adors = adocon.Execute("select a_no4119 from 运动员成绩表4119 where a_no4119=" & Label3.Caption & "")
If adors.EOF Then
adocon.Execute ("insert into 运动员成绩表4119(a_no4119,a_results4119,a_ag4119) values(" & Label3.Caption & ",'2','1')")
Else
sql1 = "update 运动员成绩表4119 set a_results4119=a_results4119+2,a_ag4119=a_ag4119+1 where " & Label3.Caption & "=a_no4119"
adocon.Execute (sql1)
End If
Set adors = adocon.Execute("select a_no4119 from 运动员成绩表4119 where a_no4119=" & Label4.Caption & "")
If adors.EOF Then
adocon.Execute ("insert into 运动员成绩表4119(a_no4119,a_results4119,a_copper4119) values(" & Label4.Caption & ",'1','1')")
Else
sql1 = "update 运动员成绩表4119 set a_results4119=a_results4119+1,a_copper4119=a_copper4119+1 where " & Label4.Caption & "=a_no4119"
adocon.Execute (sql1)
End If
List1.Text = ""
ErrMsg:
If Err.Number <> 0 Then
MsgBox Err.Number & Err.Description, vbOKOnly + vbCritical, "出错提示"
Exit Sub
End If
End Sub
Private Sub Command2_Click()
On Error GoTo ErrMsg
If List2.Text = "" Then
MsgBox "您没选择运动员号项目!", vbOKOnly + vbExclamation, "系统提示"
List2.Text = ""
Exit Sub
End If
Set adors = adocon.Execute("select a_gold4119 from 运动员成绩表4119 where a_no4119=" & List2.Text & "")
If adors(0) <> 0 Then
Label8.Caption = adors(0)
Else
Label8.Caption = 0
End If
List2.Text = ""
ErrMsg:
If Err.Number <> 0 Then
MsgBox Err.Number & Err.Description, vbOKOnly + vbCritical, "出错提示"
Exit Sub
End If
End Sub
Private Sub Command3_Click()
Unload Me
'MDIForm1.Show
End Sub
Private Sub Command4_Click()
On Error GoTo ErrMsg
If List2.Text = "" Then
MsgBox "您没选择运动员号项目!", vbOKOnly + vbExclamation, "系统提示"
List2.Text = ""
Exit Sub
End If
Set adors = adocon.Execute("select a_results4119 from 运动员成绩表4119 where a_no4119=" & List2.Text & "")
If adors(0) <> 0 Then
Label10.Caption = adors(0)
Else
Label10.Caption = 0
End If
List2.Text = ""
ErrMsg:
If Err.Number <> 0 Then
MsgBox Err.Number & Err.Description, vbOKOnly + vbCritical, "出错提示"
Exit Sub
End If
End Sub
Private Sub Form_Load()
On Error GoTo ErrMsg
Dim sql As String
sql = "select i_name4119 from 运动项目表4119"
Set adors = adocon.Execute(sql)
Do While adors.EOF = False
List1.AddItem adors(0)
adors.MoveNext
Loop
Dim sql2 As String
sql2 = "select a_no4119 from 运动员成绩表4119"
Set adors = adocon.Execute(sql2)
Do While adors.EOF = False
List2.AddItem adors(0)
adors.MoveNext
Loop
Label2.Caption = ""
Label3.Caption = ""
Label4.Caption = ""
ErrMsg:
If Err.Number <> 0 Then
MsgBox Err.Number & Err.Description, vbOKOnly + vbCritical, "出错提示"
Exit Sub
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -