?? frmcpgl.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("刪除記錄將無法恢復(fù),確實(shí)要刪除?", 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 '只允許修改數(shù)據(jù)
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)
'將主窗體設(shè)置為可用,并將其顯示
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)
'為這個(gè) recordset 顯示當(dāng)前記錄位置
adoCPGL.Caption = "第" & CStr(adoCPGL.Recordset.AbsolutePosition) & "條記錄"
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -