📄 scordform.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form ScordForm
BorderStyle = 1 'Fixed Single
Caption = "运动项目积分设置窗口"
ClientHeight = 6450
ClientLeft = 45
ClientTop = 405
ClientWidth = 8100
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 6450
ScaleWidth = 8100
Begin VB.Frame Frame2
Caption = "项目积分设置"
Height = 6255
Left = 120
TabIndex = 1
Top = 120
Width = 2895
Begin VB.TextBox txtNo
Enabled = 0 'False
Height = 270
Left = 1080
TabIndex = 13
Top = 360
Width = 1695
End
Begin VB.CommandButton delBnt
Caption = "删除"
Height = 375
Left = 120
TabIndex = 11
Top = 3960
Width = 2655
End
Begin VB.CommandButton editBnt
Caption = "修改"
Height = 375
Left = 120
TabIndex = 10
Top = 3240
Width = 2655
End
Begin VB.CommandButton addBnt
Caption = "添加"
Height = 375
Left = 120
TabIndex = 9
Top = 2520
Width = 2655
End
Begin VB.TextBox txtscord
Height = 270
Left = 1080
TabIndex = 8
Top = 2040
Width = 1695
End
Begin VB.ComboBox rankCombo
Height = 300
ItemData = "ScordForm.frx":0000
Left = 1080
List = "ScordForm.frx":0002
TabIndex = 7
Top = 1440
Width = 1695
End
Begin VB.ComboBox sportCombo
Height = 300
Left = 1080
TabIndex = 6
Top = 840
Width = 1695
End
Begin VB.Label Label4
Caption = "序号:"
Height = 255
Left = 120
TabIndex = 12
Top = 360
Width = 975
End
Begin VB.Label Label3
Caption = "项目积分:"
Height = 255
Left = 120
TabIndex = 5
Top = 2040
Width = 975
End
Begin VB.Label Label2
Caption = "项目名次:"
Height = 255
Left = 120
TabIndex = 4
Top = 1440
Width = 975
End
Begin VB.Label Label1
Caption = "项目名称:"
Height = 255
Left = 120
TabIndex = 3
Top = 840
Width = 1095
End
End
Begin VB.Frame Frame1
Caption = "项目积分列表"
Height = 6255
Left = 3120
TabIndex = 0
Top = 120
Width = 4815
Begin MSFlexGridLib.MSFlexGrid MSF
Height = 5895
Left = 120
TabIndex = 2
Top = 240
Width = 4575
_ExtentX = 8070
_ExtentY = 10398
_Version = 393216
SelectionMode = 1
End
End
End
Attribute VB_Name = "ScordForm"
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 = 5
.TextMatrix(0, 1) = "序号"
.TextMatrix(0, 2) = "项目名称"
.TextMatrix(0, 3) = "名次"
.TextMatrix(0, 4) = "积分"
.ColWidth(0) = 100
.ColWidth(1) = 1300
.ColWidth(2) = 1200
.ColWidth(3) = 1200
.FixedRows = 1
For i = 1 To 4
.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 sport_scord_id,sport_item_name,sport_scord_rank,sport_scord_no from sport_item,sport_scord where sport_item.sport_item_id = sport_scord.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
.TextMatrix(.Rows - 1, i) = mrc1.Fields(i - 1)
Next i
mrc1.MoveNext
Loop
mrc1.Close
End With
End If
End Sub
Public Sub init()
rankCombo.AddItem "1"
rankCombo.AddItem "2"
rankCombo.AddItem "3"
rankCombo.AddItem "4"
rankCombo.AddItem "5"
rankCombo.AddItem "6"
rankCombo.AddItem "7"
rankCombo.AddItem "8"
strSql = "select sport_item_id,sport_item_name from sport_item"
Set rs = ExecuteSQL(Trim(strSql))
If rs.EOF = False Then
rs.MoveFirst
Do While Not rs.EOF
sportCombo.AddItem rs.Fields(1)
rs.MoveNext
Loop
rs.Close
End If
End Sub
Private Sub addBnt_Click()
'Dim id As String
If sportCombo.Text = "" Then
MsgBox "项目名称不能为空!", vbExclamation + vbOKOnly, "警告"
Exit Sub
Else
strSql = "select sport_item_id from sport_item where sport_item_name = '" & Trim(sportCombo.Text) & "'"
Set rs = ExecuteSQL(Trim(strSql))
If rs.EOF = True Then
MsgBox "项目名称不正确!", vbExclamation + vbOKOnly, "警告"
rs.Close
Exit Sub
Else
rs.MoveFirst
id = rs.Fields(0)
rs.Close
End If
End If
If rankCombo.Text = "" Then
MsgBox "名次不能为空!", vbExclamation + vbOKOnly, "警告"
Exit Sub
Else
If IsNumeric(rankCombo.Text) Then
If rankCombo.Text < 1 Or rankCombo.Text > 8 Then
MsgBox "名次不对!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
Else
MsgBox "名次必须为整数!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
End If
If txtscord.Text = "" Then
MsgBox "名次不能为空!", vbExclamation + vbOKOnly, "警告"
Exit Sub
Else
If Not IsNumeric(txtscord.Text) Then
MsgBox "积分必须是整数!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
End If
strSql = "insert into sport_scord (sport_item_id,sport_scord_rank,sport_scord_no) values(" & id & "," & Trim(rankCombo.Text) & "," & Trim(txtscord.Text) & ")"
If ExecuteUpdateSQL(Trim(strSql)) Then
MsgBox "添加记录成功!", vbExclamation + vbOKOnly, "警告"
Me.classshowdata
Else
MsgBox "添加记录失败!" & strSql, vbExclamation + vbOKOnly, "警告"
End If
End Sub
Private Sub delBnt_Click()
If txtNo.Text = "" Then
MsgBox "序号不对!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
strSql = "delete from sport_scord where sport_scord_id = " & Trim(txtNo.Text)
If ExecuteUpdateSQL(Trim(strSql)) Then
MsgBox "删除记录成功!", vbExclamation + vbOKOnly, "警告"
Me.classshowdata
Else
MsgBox "删除记录失败!" & strSql, vbExclamation + vbOKOnly, "警告"
End If
End Sub
Private Sub editBnt_Click()
If txtNo.Text = "" Then
MsgBox "序号不对!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
If sportCombo.Text = "" Then
MsgBox "项目名称不能为空!", vbExclamation + vbOKOnly, "警告"
Exit Sub
Else
strSql = "select sport_item_id from sport_item where sport_item_name = '" & Trim(sportCombo.Text) & "'"
Set rs = ExecuteSQL(Trim(strSql))
If rs.EOF = True Then
MsgBox "项目名称不正确!", vbExclamation + vbOKOnly, "警告"
rs.Close
Exit Sub
Else
rs.MoveFirst
id = rs.Fields(0)
rs.Close
End If
End If
If rankCombo.Text = "" Then
MsgBox "名次不能为空!", vbExclamation + vbOKOnly, "警告"
Exit Sub
Else
If IsNumeric(rankCombo.Text) Then
If rankCombo.Text < 1 Or rankCombo.Text > 8 Then
MsgBox "名次不对!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
Else
MsgBox "名次必须为整数!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
End If
If txtscord.Text = "" Then
MsgBox "名次不能为空!", vbExclamation + vbOKOnly, "警告"
Exit Sub
Else
If Not IsNumeric(txtscord.Text) Then
MsgBox "积分必须是整数!", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
End If
strSql = "update sport_scord set sport_item_id = " & id & ",sport_scord_no=" & Trim(txtscord.Text) & ",sport_scord_rank=" & Trim(rankCombo.Text) & " where sport_scord_id = " & Trim(txtNo.Text)
If ExecuteUpdateSQL(Trim(strSql)) Then
MsgBox "修改记录成功!", vbExclamation + vbOKOnly, "警告"
Me.classshowdata
Else
MsgBox "修改记录失败!" & strSql, vbExclamation + vbOKOnly, "警告"
End If
End Sub
Private Sub MSF_Click()
txtNo.Text = MSF.TextMatrix(MSF.RowSel, 1)
sportCombo.Text = MSF.TextMatrix(MSF.RowSel, 2)
rankCombo.Text = MSF.TextMatrix(MSF.RowSel, 3)
txtscord.Text = MSF.TextMatrix(MSF.RowSel, 4)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -