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

📄 frm_addcar.frm

📁 共享一下一个不错的东东用VB+sql开发的销售系统.里头附带:sql 和 vb 源码.
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frm_addCar 
   Caption         =   "增加轿车信息"
   ClientHeight    =   4470
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5085
   LinkTopic       =   "Form1"
   ScaleHeight     =   4470
   ScaleWidth      =   5085
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Cmd_Cancel 
      Caption         =   "取消"
      Height          =   375
      Left            =   2760
      TabIndex        =   12
      Top             =   3840
      Width           =   855
   End
   Begin VB.CommandButton Cmd_Add 
      Caption         =   "添加"
      Height          =   375
      Left            =   1200
      TabIndex        =   11
      Top             =   3840
      Width           =   855
   End
   Begin VB.Frame Frame1 
      Caption         =   "Frame1"
      Height          =   3375
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   4575
      Begin MSAdodcLib.Adodc Adodc1 
         Height          =   330
         Left            =   240
         Top             =   3000
         Visible         =   0   'False
         Width           =   1815
         _ExtentX        =   3201
         _ExtentY        =   582
         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    =   ""
         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.TextBox txtInfo 
         Appearance      =   0  'Flat
         Height          =   1335
         Left            =   960
         TabIndex        =   10
         Top             =   1560
         Width           =   3255
      End
      Begin VB.TextBox txtTime 
         Appearance      =   0  'Flat
         Height          =   300
         Left            =   3000
         TabIndex        =   8
         Top             =   960
         Width           =   1215
      End
      Begin VB.TextBox txtPrice 
         Appearance      =   0  'Flat
         Height          =   300
         Left            =   960
         TabIndex        =   6
         Top             =   960
         Width           =   1215
      End
      Begin VB.TextBox txtBrand 
         Appearance      =   0  'Flat
         Height          =   300
         Left            =   3000
         TabIndex        =   4
         Top             =   360
         Width           =   1215
      End
      Begin VB.TextBox txtName 
         Appearance      =   0  'Flat
         Height          =   300
         Left            =   960
         TabIndex        =   2
         Top             =   360
         Width           =   1215
      End
      Begin VB.Label Label6 
         Caption         =   "备注"
         Height          =   255
         Left            =   240
         TabIndex        =   9
         Top             =   1560
         Width           =   615
      End
      Begin VB.Label Label5 
         Caption         =   "保修期"
         Height          =   300
         Left            =   2400
         TabIndex        =   7
         Top             =   1000
         Width           =   615
      End
      Begin VB.Label Label4 
         Caption         =   "价格"
         Height          =   300
         Left            =   240
         TabIndex        =   5
         Top             =   1000
         Width           =   495
      End
      Begin VB.Label Label3 
         Caption         =   "品牌"
         Height          =   300
         Left            =   2400
         TabIndex        =   3
         Top             =   400
         Width           =   495
      End
      Begin VB.Label Label2 
         Caption         =   "型号"
         Height          =   300
         Left            =   240
         TabIndex        =   1
         Top             =   400
         Width           =   615
      End
   End
End
Attribute VB_Name = "Frm_addCar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Cmd_add_Click()
    Dim txtId As Integer
    
    Adodc1.RecordSource = "SELECT * FROM Car Order by Car_id desc"
    Adodc1.Refresh
    If Adodc1.Recordset.EOF = True Then
        txtId = 1
    Else
        txtId = Adodc1.Recordset.Fields(0) + 1
    End If
 
    
    If txtBrand.Text = "" Then
       MsgBox ("请输入汽车品牌")
       Exit Sub
    End If
    
    If txtPrice.Text = "" Then
       MsgBox ("请输入汽车价格")
       Exit Sub
    End If
    
    If txtName.Text = "" Then
       MsgBox ("请输入汽车型号")
       Exit Sub
    End If
    
    If txtTime.Text = "" Then
       MsgBox ("请输入汽车保修期")
       Exit Sub
    End If
    
    '增加新车
    Adodc1.Recordset.AddNew
    Adodc1.Recordset.Fields(0).Value = Val(txtId)
    Adodc1.Recordset.Fields(1).Value = Trim(txtName.Text)
    Adodc1.Recordset.Fields(2).Value = Trim(txtBrand.Text)
    Adodc1.Recordset.Fields(3).Value = Val(Trim(txtPrice.Text))
    Adodc1.Recordset.Fields(4).Value = Trim(txtTime.Text)
    Adodc1.Recordset.Fields(5).Value = Trim(txtInfo.Text)
    
    Adodc1.Recordset.Update
    Adodc1.Refresh
    MsgBox "汽车信息增加完成"
    Unload Me
End Sub

Private Sub Cmd_Cancel_Click()
    Unload Me
End Sub

⌨️ 快捷键说明

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