⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sportsform.frm

📁 运动会管理系统 运动会管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form sportsForm 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "运动项目管理窗口"
   ClientHeight    =   6030
   ClientLeft      =   45
   ClientTop       =   405
   ClientWidth     =   7530
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6030
   ScaleWidth      =   7530
   Begin VB.Frame Frame2 
      Caption         =   "运动项目编辑框"
      Height          =   2895
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   7335
      Begin VB.CommandButton delBnt 
         Caption         =   "删除"
         Height          =   375
         Left            =   5760
         TabIndex        =   15
         Top             =   2160
         Width           =   1455
      End
      Begin VB.CommandButton editBnt 
         Caption         =   "修改"
         Height          =   375
         Left            =   3000
         TabIndex        =   14
         Top             =   2160
         Width           =   1335
      End
      Begin VB.CommandButton addBnt 
         Caption         =   "添加"
         Height          =   375
         Left            =   240
         TabIndex        =   13
         Top             =   2160
         Width           =   1335
      End
      Begin VB.Frame Frame3 
         Caption         =   "备注"
         Height          =   855
         Left            =   120
         TabIndex        =   11
         Top             =   1080
         Width           =   7095
         Begin VB.TextBox txtNote 
            Height          =   495
            Left            =   120
            MultiLine       =   -1  'True
            TabIndex        =   12
            Top             =   240
            Width           =   6855
         End
      End
      Begin VB.TextBox txtRecordTime 
         Height          =   270
         Left            =   5040
         TabIndex        =   10
         Top             =   720
         Width           =   2055
      End
      Begin VB.TextBox txtRecordor 
         Height          =   270
         Left            =   1320
         TabIndex        =   8
         Top             =   720
         Width           =   1935
      End
      Begin VB.TextBox txtRecord 
         Height          =   270
         Left            =   5040
         TabIndex        =   6
         Top             =   240
         Width           =   2055
      End
      Begin VB.TextBox txtSportName 
         Height          =   270
         Left            =   1320
         TabIndex        =   4
         Top             =   240
         Width           =   1935
      End
      Begin VB.Label Label4 
         Caption         =   "记录产生时间:"
         Height          =   255
         Left            =   3720
         TabIndex        =   9
         Top             =   720
         Width           =   1455
      End
      Begin VB.Label Label3 
         Caption         =   "记录保持者:"
         Height          =   255
         Left            =   120
         TabIndex        =   7
         Top             =   720
         Width           =   1335
      End
      Begin VB.Label Label2 
         Caption         =   "项目记录:"
         Height          =   255
         Left            =   3720
         TabIndex        =   5
         Top             =   240
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "项目名称:"
         Height          =   255
         Left            =   120
         TabIndex        =   3
         Top             =   240
         Width           =   1215
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "运动项目列表框"
      Height          =   2895
      Left            =   120
      TabIndex        =   0
      Top             =   3000
      Width           =   7335
      Begin MSFlexGridLib.MSFlexGrid MSF 
         Height          =   2535
         Left            =   120
         TabIndex        =   1
         Top             =   240
         Width           =   7095
         _ExtentX        =   12515
         _ExtentY        =   4471
         _Version        =   393216
         SelectionMode   =   1
      End
   End
End
Attribute VB_Name = "sportsForm"
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 = 6
    .TextMatrix(0, 1) = "项目名"
    .TextMatrix(0, 2) = "最高记录"
    .TextMatrix(0, 3) = "记录保持者"
    .TextMatrix(0, 4) = "记录创建时间"
    .TextMatrix(0, 5) = "备注"
    .ColWidth(0) = 100
    .ColWidth(1) = 1300
    .ColWidth(2) = 1200
    .ColWidth(3) = 1200
    .ColWidth(4) = 1500
    .ColWidth(5) = 2000
    .FixedRows = 1
    For i = 1 To 5
      .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 * from sport_item"
  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 - 1
      .TextMatrix(.Rows - 1, i) = mrc1.Fields(i)
     Next i
     mrc1.MoveNext
    Loop
    mrc1.Close
 End With
 End If
End Sub

Private Sub addBnt_Click()
    If sportsForm.txtSportName = "" Then
        MsgBox "项目名不能为空!", vbExclamation + vbOKOnly, "警告"
        Exit Sub
    Else
        strSql = "select * from sport_item where sport_item_name = '" & Trim(sportsForm.txtSportName) & "'"
        Set rs = ExecuteSQL(strSql)
        If rs.EOF = False Then
         MsgBox "项目名已经存在!", vbExclamation + vbOKOnly, "警告"
         sportsForm.txtSportName.SetFocus
         rs.Close
         Exit Sub
        End If
    End If
    
    strSql = "insert into sport_item (sport_item_name,sport_item_record,sport_item_recordor,sport_item_recordtime,sport_item_note) values('" & Trim(sportsForm.txtSportName) & "','" & Trim(sportsForm.txtRecord) & "','" & Trim(sportsForm.txtRecordor) & "','" & Trim(sportsForm.txtRecordTime) & "','" & Trim(sportsForm.txtNote) & "')"
    If ExecuteUpdateSQL(strSql) = True Then
        MsgBox "添加项目信息成功!", vbExclamation + vbOKOnly, "警告"
        sportsForm.classshowdata
    Else
        MsgBox "添加项目信息失败!", vbExclamation + vbOKOnly, "警告"
        sportsForm.txtNote.Text = strSql
    End If
End Sub

Private Sub delBnt_Click()
    If sportsForm.txtSportName = "" Then
        MsgBox "项目名不能为空!", vbExclamation + vbOKOnly, "警告"
        Exit Sub
    Else
        strSql = "select * from sport_item where sport_item_name = '" & Trim(sportsForm.txtSportName) & "'"
        Set rs = ExecuteSQL(strSql)
        If rs.EOF = True Then
         MsgBox "项目名不存在!", vbExclamation + vbOKOnly, "警告"
         sportsForm.txtSportName.SetFocus
         rs.Close
         Exit Sub
        End If
    End If
    
    strSql = "delete from sport_item where sport_item_name = '" & Trim(sportsForm.txtSportName) & "'"
    If ExecuteUpdateSQL(strSql) = True Then
        MsgBox "删除项目信息成功!", vbExclamation + vbOKOnly, "警告"
        sportsForm.classshowdata
    Else
        MsgBox "删除项目信息失败!", vbExclamation + vbOKOnly, "警告"
    End If
End Sub

Private Sub editBnt_Click()
    If sportsForm.txtSportName = "" Then
        MsgBox "项目名不能为空!", vbExclamation + vbOKOnly, "警告"
        Exit Sub
    Else
        strSql = "select * from sport_item where sport_item_name = '" & Trim(sportsForm.txtSportName) & "'"
        Set rs = ExecuteSQL(strSql)
        If rs.EOF = True Then
         MsgBox "项目名不存在!", vbExclamation + vbOKOnly, "警告"
         sportsForm.txtSportName.SetFocus
         rs.Close
         Exit Sub
        End If
    End If
    
    strSql = "update sport_item set sport_item_record = '" & Trim(sportsForm.txtRecord) & "',sport_item_recordor = '" & Trim(sportsForm.txtRecordor) & "',sport_item_recordtime = '" & Trim(sportsForm.txtRecordTime) & "',sport_item_note = '" & Trim(sportsForm.txtNote) & "' where sport_item_name = '" & Trim(sportsForm.txtSportName) & "'"
    If ExecuteUpdateSQL(strSql) = True Then
        MsgBox "修改项目信息成功!", vbExclamation + vbOKOnly, "警告"
        sportsForm.classshowdata
    Else
        MsgBox "修改项目信息失败!", vbExclamation + vbOKOnly, "警告"
    End If
End Sub

Private Sub MSF_Click()
    sportsForm.txtSportName = MSF.TextMatrix(MSF.RowSel, 1)
    sportsForm.txtRecord = MSF.TextMatrix(MSF.RowSel, 2)
    sportsForm.txtRecordor = MSF.TextMatrix(MSF.RowSel, 3)
    sportsForm.txtRecordTime = MSF.TextMatrix(MSF.RowSel, 4)
    sportsForm.txtNote = MSF.TextMatrix(MSF.RowSel, 5)
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -