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

📄 frm_modi_del_cus.frm

📁 共享一下一个不错的东东用VB+sql开发的销售系统.里头附带:sql 和 vb 源码.
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "msadodc.ocx"
Begin VB.Form Frm_edit_Cus 
   Caption         =   "编辑客户信息"
   ClientHeight    =   5880
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6480
   LinkTopic       =   "Form1"
   ScaleHeight     =   5880
   ScaleWidth      =   6480
   StartUpPosition =   3  '窗口缺省
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   480
      Top             =   5400
      Width           =   2175
      _ExtentX        =   3836
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   3
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "DSN=CarSaleSys"
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   "CarSaleSys"
      OtherAttributes =   ""
      UserName        =   "sa"
      Password        =   "sa"
      RecordSource    =   "select * from Customer"
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Frame Frame2 
      Caption         =   "修改客户信息"
      Height          =   735
      Index           =   1
      Left            =   120
      TabIndex        =   29
      Top             =   4560
      Width           =   6255
      Begin VB.CommandButton Cmd_modi 
         Caption         =   "修改记录"
         Height          =   375
         Left            =   360
         TabIndex        =   15
         Top             =   240
         Width           =   1215
      End
      Begin VB.CommandButton Cmd_del 
         Caption         =   "删除记录"
         Height          =   375
         Left            =   1800
         TabIndex        =   16
         Top             =   240
         Width           =   1215
      End
      Begin VB.CommandButton Cmd_quit 
         Caption         =   "退出"
         Height          =   375
         Left            =   3240
         TabIndex        =   17
         Top             =   240
         Width           =   1215
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "查看客户信息"
      Height          =   735
      Index           =   0
      Left            =   120
      TabIndex        =   28
      Top             =   3720
      Width           =   6255
      Begin VB.CommandButton Cmd_final 
         Caption         =   "最后一条记录"
         Height          =   375
         Left            =   4680
         TabIndex        =   14
         Top             =   240
         Width           =   1455
      End
      Begin VB.CommandButton Cmd_next 
         Caption         =   "下一条记录"
         Height          =   375
         Left            =   3240
         TabIndex        =   13
         Top             =   240
         Width           =   1215
      End
      Begin VB.CommandButton Cmd_pre 
         Caption         =   "上一条记录"
         Height          =   375
         Left            =   1800
         TabIndex        =   12
         Top             =   240
         Width           =   1215
      End
      Begin VB.CommandButton Cmd_first 
         Caption         =   "第一条记录"
         Height          =   375
         Left            =   360
         TabIndex        =   11
         Top             =   240
         Width           =   1215
      End
   End
   Begin VB.TextBox cus_name 
      Appearance      =   0  'Flat
      DataField       =   "Customer_name"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1200
      TabIndex        =   1
      Top             =   360
      Width           =   1455
   End
   Begin VB.TextBox cus_job 
      Appearance      =   0  'Flat
      DataField       =   "Customer_occup"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1200
      TabIndex        =   7
      Top             =   1800
      Width           =   1455
   End
   Begin VB.TextBox cus_age 
      Appearance      =   0  'Flat
      DataField       =   "Customer_age"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1200
      TabIndex        =   5
      Top             =   1320
      Width           =   1455
   End
   Begin VB.TextBox cus_sex 
      Appearance      =   0  'Flat
      DataField       =   "Customer_sex"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1200
      TabIndex        =   3
      Top             =   840
      Width           =   1455
   End
   Begin VB.Frame Frame1 
      Height          =   3615
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   6255
      Begin VB.TextBox cus_info 
         Appearance      =   0  'Flat
         DataField       =   "Info"
         DataSource      =   "Adodc1"
         Height          =   735
         Left            =   1080
         TabIndex        =   10
         Top             =   2760
         Width           =   5055
      End
      Begin VB.TextBox cus_address 
         Appearance      =   0  'Flat
         DataField       =   "Customer_addr"
         DataSource      =   "Adodc1"
         Height          =   375
         Left            =   1080
         TabIndex        =   9
         Top             =   2280
         Width           =   5055
      End
      Begin VB.TextBox buycar_name 
         Appearance      =   0  'Flat
         DataField       =   "Buy_car"
         DataSource      =   "Adodc1"
         Height          =   375
         Left            =   3600
         TabIndex        =   2
         Top             =   360
         Width           =   2535
      End
      Begin VB.TextBox cus_num 
         Appearance      =   0  'Flat
         DataField       =   "Customer_num"
         DataSource      =   "Adodc1"
         Height          =   375
         Left            =   3600
         TabIndex        =   8
         Top             =   1800
         Width           =   2535
      End
      Begin VB.TextBox cus_tel 
         Appearance      =   0  'Flat
         DataField       =   "Customer_tel"
         DataSource      =   "Adodc1"
         Height          =   375
         Left            =   3600
         TabIndex        =   6
         Top             =   1320
         Width           =   2535
      End
      Begin VB.TextBox buycar_price 
         Appearance      =   0  'Flat
         DataField       =   "Buy_price"
         DataSource      =   "Adodc1"
         Height          =   375
         Left            =   3600
         TabIndex        =   4
         Top             =   840
         Width           =   2535
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         Caption         =   "备    注"
         Height          =   195
         Index           =   9
         Left            =   240
         TabIndex        =   27
         Top             =   2880
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "客户住址"
         Height          =   195
         Index           =   8
         Left            =   240
         TabIndex        =   26
         Top             =   2400
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "身份证号"
         Height          =   195
         Index           =   7
         Left            =   2760
         TabIndex        =   25
         Top             =   1920
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "客户电话"
         Height          =   195
         Index           =   6
         Left            =   2760
         TabIndex        =   24
         Top             =   1440
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "购车价格"
         Height          =   195
         Index           =   5
         Left            =   2760
         TabIndex        =   23
         Top             =   960
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "购车型号"
         Height          =   195
         Index           =   4
         Left            =   2760
         TabIndex        =   22
         Top             =   480
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "客户职业"
         Height          =   195
         Index           =   3
         Left            =   240
         TabIndex        =   21
         Top             =   1920
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "客户年龄"
         Height          =   195
         Index           =   1
         Left            =   240
         TabIndex        =   20
         Top             =   1440
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "客户性别"
         Height          =   195
         Index           =   2
         Left            =   240
         TabIndex        =   19
         Top             =   960
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "客户姓名"
         Height          =   300
         Index           =   0
         Left            =   240
         TabIndex        =   18
         Top             =   480
         Width           =   720
      End
   End
End
Attribute VB_Name = "Frm_edit_Cus"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public firstId As Integer
Public lastId As Integer
Public curId As Integer

Private Sub Cmd_del_Click()

    Adodc1.Recordset.Delete
    Adodc1.Recordset.Update
    
    MsgBox ("客户记录已删除")
    
    Adodc1.RecordSource = "SELECT * FROM Customer"
    Adodc1.Refresh
    
End Sub

Private Sub Cmd_final_Click()
    Adodc1.Recordset.MoveLast
    Cmd_next.Enabled = False
    Cmd_pre.Enabled = True
End Sub

Private Sub Cmd_first_Click()
    Adodc1.Recordset.MoveFirst
    Cmd_next.Enabled = True
    Cmd_pre.Enabled = False
End Sub

Private Sub Cmd_modi_Click()
    
    curId = Adodc1.Recordset.Fields(0)
    
    Adodc1.Recordset.Fields(1) = Trim(cus_name.Text)
    Adodc1.Recordset.Fields(2) = Trim(cus_sex.Text)
    Adodc1.Recordset.Fields(3) = Val(Trim(cus_age.Text))
    Adodc1.Recordset.Fields(4) = Trim(cus_job.Text)
    Adodc1.Recordset.Fields(5) = Trim(cus_num.Text)
    Adodc1.Recordset.Fields(6) = Trim(cus_tel.Text)
    Adodc1.Recordset.Fields(7) = Trim(cus_address.Text)
    Adodc1.Recordset.Fields(8) = Trim(buycar_name.Text)
    Adodc1.Recordset.Fields(9) = Trim(buycar_price.Text)
    Adodc1.Recordset.Fields(10) = Trim(cus_info.Text)
    
    Adodc1.Recordset.Update
    MsgBox ("客户记录已修改")
    
    Adodc1.RecordSource = "SELECT * FROM Customer "
    Adodc1.Refresh
    
    
    Do While Adodc1.Recordset.Fields(0) <> curId
        Adodc1.Recordset.Move (1)
    Loop
    
    
End Sub

Private Sub Cmd_next_Click()
    If Cmd_pre.Enabled = False Then
        Cmd_pre.Enabled = True
    End If
    
    Adodc1.Recordset.MoveNext
    
    If Adodc1.Recordset.Fields(0) = lastId Then
        Cmd_next.Enabled = False
    End If

End Sub

Private Sub Cmd_pre_Click()
    If Cmd_next.Enabled = False Then
        Cmd_next.Enabled = True
    End If
    

    Adodc1.Recordset.MovePrevious
    
    If Adodc1.Recordset.Fields(0) = firstId Then
        Cmd_pre.Enabled = False
    End If
End Sub

Private Sub Cmd_quit_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Adodc1.RecordSource = "SELECT * FROM Customer"
    Adodc1.Refresh
    
   
    If Adodc1.Recordset.RecordCount <> 0 Then
        Adodc1.Recordset.MoveLast
        lastId = Adodc1.Recordset.Fields(0)
        Adodc1.Recordset.MoveFirst
        firstId = Adodc1.Recordset.Fields(0)
    End If
    
    Cmd_pre.Enabled = False
    If Adodc1.Recordset.RecordCount = 1 Then
       Cmd_next.Enabled = False
    End If
End Sub

⌨️ 快捷键说明

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