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

📄 frmcpgl.frm

📁 petrostation + sysytem
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmCPGL 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "油品管理"
   ClientHeight    =   6945
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   11625
   Icon            =   "frmCPGL.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "frmCPGL.frx":29C12
   ScaleHeight     =   6945
   ScaleWidth      =   11625
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command5 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   9480
      TabIndex        =   5
      Top             =   5640
      Width           =   1335
   End
   Begin VB.CommandButton Command4 
      Caption         =   "保存"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   7320
      TabIndex        =   4
      Top             =   5640
      Width           =   1335
   End
   Begin VB.CommandButton Command3 
      Caption         =   "删除"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   5040
      TabIndex        =   3
      Top             =   5640
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Caption         =   "修改"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   2760
      TabIndex        =   2
      Top             =   5640
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "添加"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   600
      TabIndex        =   1
      Top             =   5640
      Width           =   1335
   End
   Begin MSDataGridLib.DataGrid dgdCPGL 
      Bindings        =   "frmCPGL.frx":452F1
      Height          =   5415
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   11655
      _ExtentX        =   20558
      _ExtentY        =   9551
      _Version        =   393216
      AllowUpdate     =   0   'False
      HeadLines       =   1
      RowHeight       =   15
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin MSAdodcLib.Adodc adoCPGL 
      Height          =   495
      Left            =   0
      Top             =   6480
      Width           =   11655
      _ExtentX        =   20558
      _ExtentY        =   873
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   1
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=SQLOLEDB.1;Password=ecc;Persist Security Info=True;User ID=sa;Initial Catalog=PetrolStation System;Data Source=(local)"
      OLEDBString     =   "Provider=SQLOLEDB.1;Password=ecc;Persist Security Info=True;User ID=sa;Initial Catalog=PetrolStation System;Data Source=(local)"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "select * from PS_Products"
      Caption         =   ""
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
End
Attribute VB_Name = "frmCPGL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    On Error GoTo AddErr
    
    dgdCPGL.AllowAddNew = True      '允许添加新记录
    dgdCPGL.AllowUpdate = True      '允许编辑记录
    dgdCPGL.AllowDelete = False     '禁止删除记录
    adoCPGL.Recordset.MoveLast      '移动到新增加的记录
    dgdCPGL.SetFocus
    Exit Sub
AddErr:
    MsgBox err.Description
End Sub

Private Sub Command4_Click()
    On Error GoTo UpdateErr
    
    adoCPGL.Recordset.UpdateBatch adAffectAll
    dgdCPGL.AllowUpdate = False
    dgdCPGL.AllowAddNew = False
    dgdCPGL.AllowDelete = False
     MsgBox "恭喜您,记录保存成功!", vbOKOnly, "保存记录"
    Exit Sub
UpdateErr:
    MsgBox err.Description
End Sub

Private Sub Command3_Click()
    On Error GoTo DeleteErr
    
    dgdCPGL.AllowAddNew = False
    dgdCPGL.AllowUpdate = False
    With adoCPGL.Recordset
        If MsgBox("删除记录将无法恢复,确实要删除?", vbYesNo + vbInformation, _
                    "提示") = vbYes Then
            .Delete
            .MoveNext
            If .EOF Then .MoveLast
        End If
    End With
    Exit Sub
DeleteErr:
    MsgBox err.Description
End Sub

Private Sub Command2_Click()
    On Error GoTo UpdateErr
    dgdCPGL.AllowAddNew = False
    dgdCPGL.AllowDelete = False
    dgdCPGL.AllowUpdate = True      '只允许修改数据
    Exit Sub
UpdateErr:
    MsgBox err.Description
End Sub

Private Sub Command5_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    adoCPGL.CommandType = adCmdText
    adoCPGL.RecordSource = "select * from PS_Products"
    adoCPGL.Refresh
End Sub

Private Sub Form_Unload(Cancel As Integer)
    '将主窗体设置为可用,并将其显示
    frmMain.Enabled = True
    frmMain.Show
End Sub

Private Sub adoCPGL_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, _
    ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, _
    ByVal pRecordset As ADODB.Recordset)
    '为这个 recordset 显示当前记录位置
    adoCPGL.Caption = "第" & CStr(adoCPGL.Recordset.AbsolutePosition) & "条记录"
End Sub


⌨️ 快捷键说明

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