📄 cars_information.frm
字号:
Left = 4560
TabIndex = 36
Top = 2640
Width = 255
End
Begin VB.Label Label19
Caption = "%"
Height = 255
Left = 4560
TabIndex = 35
Top = 2040
Width = 255
End
Begin VB.Label Label18
Caption = "%"
Height = 255
Left = 1800
TabIndex = 34
Top = 3120
Width = 255
End
Begin VB.Label Label17
Caption = "%"
Height = 255
Left = 1800
TabIndex = 33
Top = 2520
Width = 375
End
Begin VB.Label Label12
Caption = "%"
Height = 255
Left = 1800
TabIndex = 32
Top = 1920
Width = 255
End
Begin VB.Label Label16
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Left = 5160
TabIndex = 31
Top = 1320
Width = 135
End
Begin VB.Label Label15
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Left = 2520
TabIndex = 30
Top = 1200
Width = 135
End
Begin VB.Label Label14
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Left = 5520
TabIndex = 29
Top = 600
Width = 135
End
Begin VB.Label Label13
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Left = 2520
TabIndex = 28
Top = 600
Width = 135
End
Begin VB.Label Label11
Caption = "品 牌"
Height = 255
Left = 3120
TabIndex = 27
Top = 3000
Width = 615
End
Begin VB.Label Label10
Caption = "经济性"
Height = 255
Left = 360
TabIndex = 26
Top = 3000
Width = 615
End
Begin VB.Label Label9
Caption = "舒适性"
Height = 255
Left = 3120
TabIndex = 25
Top = 2520
Width = 615
End
Begin VB.Label Label8
Caption = "通过性"
Height = 255
Left = 360
TabIndex = 24
Top = 2400
Width = 615
End
Begin VB.Label Label2
Caption = "车系"
Height = 255
Left = 3120
TabIndex = 8
Top = 600
Width = 375
End
Begin VB.Label Label5
Caption = "销 价"
Height = 255
Left = 3120
TabIndex = 7
Top = 1320
Width = 615
End
Begin VB.Label Label4
Caption = "进 价"
Height = 255
Left = 360
TabIndex = 6
Top = 1200
Width = 615
End
Begin VB.Label Label6
Caption = "安全性"
Height = 255
Left = 360
TabIndex = 5
Top = 1800
Width = 615
End
Begin VB.Label Label7
Caption = "动力性"
Height = 255
Left = 3120
TabIndex = 4
Top = 1920
Width = 615
End
Begin VB.Label Label1
Caption = "车型"
Height = 255
Left = 360
TabIndex = 3
Top = 600
Width = 375
End
End
Begin VB.CommandButton Command3
BackColor = &H80000010&
Caption = "删除"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6840
TabIndex = 0
Top = 3960
Width = 975
End
Begin VB.CommandButton Command2
BackColor = &H80000010&
Caption = "保存"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2160
TabIndex = 20
Top = 3960
Width = 975
End
Begin VB.Line Line2
X1 = 0
X2 = 9840
Y1 = 4560
Y2 = 4560
End
Begin VB.Line Line1
X1 = 0
X2 = 9840
Y1 = 3840
Y2 = 3840
End
End
Attribute VB_Name = "Cars_information"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public adoCon As New ADODB.Connection
Public rs As New ADODB.Recordset
Public Sub main()
Set adoCon = New ADODB.Connection
adoCon.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=bai;password=052606241;Initial Catalog=CARS;Data Source=5c92669bd5be43c"
End Sub
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
End Sub
Private Sub Command2_Click()
Call main
If Text1.Text = "" Then
MsgBox "车型不能为空!", 64, "提示信息"
Text1.SetFocus: Exit Sub
End If
If Text2.Text = "" Then
MsgBox "车系不能为空!", 64, "提示信息"
Text2.SetFocus: Exit Sub
End If
If Text4.Text = "" Then
MsgBox "进价不能为空!", 64, "提示信息"
Text4.SetFocus: Exit Sub
End If
If Text5.Text = "" Then
MsgBox "销价不能为空!", 64, "提示信息"
Text5.SetFocus: Exit Sub
End If
rs.Open "select * from 车型信息表", adoCon, adOpenKeyset, adLockOptimistic
rs.AddNew
rs.Fields("车型") = Text1.Text
rs.Fields("车系") = Text2.Text
rs.Fields("进价") = Text4.Text
rs.Fields("销价") = Val(Text5.Text)
rs.Fields("安全性") = Val(Text6.Text)
rs.Fields("动力性") = Val(Text7.Text)
rs.Fields("通过性") = Val(Text8.Text)
rs.Fields("舒适性") = Val(Text9.Text)
rs.Fields("经济性") = Val(Text10.Text)
rs.Fields("品牌") = Val(Text11.Text)
rs.Fields("车型介绍") = Text12.Text
rs.Update
MsgBox "车型信息保存成功!", 0, "提示信息"
Adodc1.Refresh
rs.Close
End Sub
Private Sub Command3_Click()
If Adodc1.Recordset.EOF = False Then
c = MsgBox("您确认删除该记录么?", 17, "提示信息")
If c = vbOK Then
Adodc1.Recordset.Delete
Adodc1.Refresh
MsgBox "该记录已成功删除!", 0, "提示信息"
Else
End If
Else
MsgBox "当前数据中已经没有可删除的记录", 17, "提示信息"
End If
End Sub
Private Sub Command4_Click()
Unload Cars_information
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -