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

📄 frm_edit_car.frm

📁 SQL Server 2000课程设计案例:轿车销售管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frm_edit_Car 
   Caption         =   "编辑轿车信息"
   ClientHeight    =   4545
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5745
   LinkTopic       =   "Form1"
   ScaleHeight     =   4545
   ScaleWidth      =   5745
   StartUpPosition =   3  'Windows Default
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   360
      Top             =   4080
      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    =   "SELECT * FROM Car"
      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           =   0
      Left            =   120
      TabIndex        =   19
      Top             =   2400
      Width           =   5535
      Begin VB.CommandButton Cmd_first 
         Caption         =   "第一条记录"
         Height          =   375
         Left            =   360
         TabIndex        =   6
         Top             =   240
         Width           =   1095
      End
      Begin VB.CommandButton Cmd_pre 
         Caption         =   "前一条记录"
         Height          =   375
         Left            =   1560
         TabIndex        =   7
         Top             =   240
         Width           =   1095
      End
      Begin VB.CommandButton Cmd_next 
         Caption         =   "下一条记录"
         Height          =   375
         Left            =   2760
         TabIndex        =   8
         Top             =   240
         Width           =   1095
      End
      Begin VB.CommandButton Cmd_final 
         Caption         =   "最后一条记录"
         Height          =   375
         Left            =   3960
         TabIndex        =   9
         Top             =   240
         Width           =   1335
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "修改轿车信息"
      Height          =   735
      Index           =   1
      Left            =   120
      TabIndex        =   18
      Top             =   3240
      Width           =   5535
      Begin VB.CommandButton Cmd_quit 
         Caption         =   "退出"
         Height          =   375
         Left            =   2760
         TabIndex        =   12
         Top             =   240
         Width           =   1095
      End
      Begin VB.CommandButton Cmd_del 
         Caption         =   "删除记录"
         Height          =   375
         Left            =   1560
         TabIndex        =   11
         Top             =   240
         Width           =   1095
      End
      Begin VB.CommandButton Cmd_modi 
         Caption         =   "修改记录"
         Height          =   375
         Left            =   360
         TabIndex        =   10
         Top             =   240
         Width           =   1095
      End
   End
   Begin VB.TextBox txtCarbrand 
      Appearance      =   0  'Flat
      DataField       =   "Car_brand"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   3960
      TabIndex        =   2
      Top             =   240
      Width           =   1575
   End
   Begin VB.TextBox txtCarprice 
      Appearance      =   0  'Flat
      DataField       =   "Car_price"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1200
      TabIndex        =   3
      Top             =   720
      Width           =   1575
   End
   Begin VB.Frame Frame1 
      Height          =   2295
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   5535
      Begin VB.TextBox txtCarinfo 
         Appearance      =   0  'Flat
         DataField       =   "Car_info"
         DataSource      =   "Adodc1"
         Height          =   975
         Left            =   1080
         TabIndex        =   5
         Top             =   1200
         Width           =   4335
      End
      Begin VB.TextBox txtCarname 
         Appearance      =   0  'Flat
         DataField       =   "Car_name"
         DataSource      =   "Adodc1"
         Height          =   375
         Left            =   1080
         TabIndex        =   1
         Top             =   240
         Width           =   1575
      End
      Begin VB.TextBox txtCartime 
         Appearance      =   0  'Flat
         DataField       =   "Car_time"
         DataSource      =   "Adodc1"
         Height          =   375
         Left            =   3840
         TabIndex        =   4
         Top             =   720
         Width           =   1575
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "具体描述"
         Height          =   195
         Index           =   8
         Left            =   240
         TabIndex        =   17
         Top             =   1320
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "保修期"
         Height          =   195
         Index           =   5
         Left            =   2880
         TabIndex        =   16
         Top             =   840
         Width           =   540
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "轿车品牌"
         Height          =   195
         Index           =   4
         Left            =   2880
         TabIndex        =   15
         Top             =   360
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "轿车价格"
         Height          =   195
         Index           =   2
         Left            =   240
         TabIndex        =   14
         Top             =   840
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "轿车型号"
         Height          =   195
         Index           =   0
         Left            =   240
         TabIndex        =   13
         Top             =   360
         Width           =   720
      End
   End
End
Attribute VB_Name = "Frm_edit_Car"
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 Car"
    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_pre.Enabled = False
    Cmd_next.Enabled = True
End Sub

Private Sub Cmd_modi_Click()
    curId = Adodc1.Recordset.Fields(0)
    
    Adodc1.Recordset.Fields(1) = Trim(txtCarname.Text)
    Adodc1.Recordset.Fields(2) = Trim(txtCarbrand.Text)
    Adodc1.Recordset.Fields(3) = Val(Trim(txtCarprice.Text))
    Adodc1.Recordset.Fields(4) = Trim(txtCartime.Text)
    Adodc1.Recordset.Fields(5) = Trim(txtCarinfo.Text)
    
    Adodc1.Recordset.Update
    MsgBox ("轿车记录已修改")
    
    Adodc1.RecordSource = "SELECT * FROM Car "
    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 Car"
    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 + -