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

📄 playerstatistics.frm

📁 NBA的部分球员
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         EndProperty
         Height          =   255
         Index           =   2
         Left            =   240
         TabIndex        =   22
         Top             =   2760
         Width           =   1455
      End
      Begin VB.Label Label1 
         Caption         =   "场均得分"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   3
         Left            =   720
         TabIndex        =   21
         Top             =   3480
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "场均助攻"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   4
         Left            =   720
         TabIndex        =   20
         Top             =   5160
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "场均篮板"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   5
         Left            =   720
         TabIndex        =   19
         Top             =   4320
         Width           =   1095
      End
      Begin VB.Label Label1 
         Caption         =   "场均抢断"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   6
         Left            =   720
         TabIndex        =   18
         Top             =   6000
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "场均盖帽"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   7
         Left            =   720
         TabIndex        =   17
         Top             =   6840
         Width           =   1095
      End
      Begin VB.Label Label1 
         Caption         =   "命中率"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   8
         Left            =   960
         TabIndex        =   16
         Top             =   7680
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "场均失误"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   9
         Left            =   720
         TabIndex        =   15
         Top             =   8520
         Width           =   975
      End
   End
   Begin VB.CommandButton Command1 
      Caption         =   "添加"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   9480
      TabIndex        =   2
      Top             =   10320
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Caption         =   "修改"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   11400
      TabIndex        =   1
      Top             =   10320
      Width           =   1455
   End
   Begin VB.CommandButton Command3 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   13440
      TabIndex        =   0
      Top             =   10320
      Width           =   1455
   End
   Begin MSDBGrid.DBGrid DBGrid1 
      Bindings        =   "PlayerStatistics.frx":09D7
      Height          =   5655
      Left            =   240
      OleObjectBlob   =   "PlayerStatistics.frx":09EB
      TabIndex        =   3
      Top             =   480
      Width           =   9015
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   14160
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   10560
      Visible         =   0   'False
      Width           =   1260
   End
   Begin VB.Label Label3 
      Caption         =   "球员统计"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   1
      Left            =   240
      TabIndex        =   31
      Top             =   6360
      Width           =   1095
   End
   Begin VB.Label Label3 
      Caption         =   "球员列表"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   0
      Left            =   240
      TabIndex        =   25
      Top             =   120
      Width           =   1095
   End
End
Attribute VB_Name = "PlayerStatistics"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim ad As Boolean   '添加状态
Dim md As Boolean   '修改状态

Private Sub Command1_Click()
On Error GoTo adderr

If ad Then
    Command1.Caption = "添加"
    Data1.Recordset.Update
    Data1.Recordset.Bookmark = Data1.Recordset.LastModified
    
    For i = 0 To 10
        Text1(i).Locked = True
    Next i
    Command2.Enabled = True
    DBGrid1.Enabled = True
    ad = False
        
Else
    For i = 0 To 10
        Text1(i).Locked = False
    Next i
    Command1.Caption = "确定"
    Data1.Recordset.AddNew
    Command2.Enabled = False
    DBGrid1.Enabled = False
    ad = True
End If

Exit Sub

adderr:
MsgBox ("修改数据无效!")
Call Command3_Click
End Sub

Private Sub Command2_Click()
On Error GoTo mferr

If md Then
    If Not judge() Then
        MsgBox ("信息填写有误!")
        Data1.Recordset.CancelUpdate
    Else
        Data1.Recordset.Update
        Data1.Recordset.Bookmark = Data1.Recordset.LastModified
    End If
    
    md = False
    For i = 0 To 10
        Text1(i).Locked = True
    Next i
    Image1.Enabled = False
    Command2.Caption = "修改"
    Command1.Enabled = True
Else
    For i = 0 To 10
        Text1(i).Locked = False
    Next i
    Image1.Enabled = True
    
    Data1.Recordset.Edit
    md = True
    Command2.Caption = "确认"
    Command1.Enabled = False
End If

Exit Sub

mferr:
MsgBox ("修改数据无效!")
Call Command3_Click
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Form_Load()
If dbpath = "" Then Unload Me
ad = False
md = False

Data1.DatabaseName = dbpath
Data2.DatabaseName = dbpath
'确定记录集

Data1.RecordSource = "Player_Statistic"
Data2.RecordSource = "Player"

'指定属性
Text1(0).DataField = "Season"
Text1(1).DataField = "GP"
Text1(2).DataField = "Mins"
Text1(3).DataField = "PPg"
Text1(4).DataField = "Rpg"
Text1(5).DataField = "Apg"
Text1(6).DataField = "SPG"
Text1(7).DataField = "Bpg"
Text1(8).DataField = "Fgp"
Text1(9).DataField = "To"
Text1(10).DataField = "Fouls"
Text1(11).DataField = "Cname"
Text2.DataField = "ID"
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
If ad Then Data1.Recordset.CancelUpdate
If md Then Data1.Recordset.CancelUpdate
End Sub

Private Sub Image1_DblClick()
CommonDialog1.Action = 1
Image1.Picture = LoadPicture(CommonDialog1.FileName)
End Sub

Private Function judge() As Boolean
'判断信息填写是否正确
judge = True

If Text1(0) = "" Then judge = False
If Text1(1) = "" Then judge = False
End Function

Private Sub Text2_Change()
If Val(Text2) > 0 Then
Data1.RecordSource = "Select * from Player_Statistic where ID= " & Text2
Data1.Refresh
End If
End Sub

⌨️ 快捷键说明

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