📄 frmkcpd.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 frmKCPD
BorderStyle = 1 'Fixed Single
Caption = "库存油品"
ClientHeight = 6615
ClientLeft = 45
ClientTop = 435
ClientWidth = 11895
Icon = "frmKCPD.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frmKCPD.frx":29C12
ScaleHeight = 6615
ScaleWidth = 11895
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "退出窗口"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 6600
TabIndex = 2
Top = 5760
Width = 1815
End
Begin VB.CommandButton Command1
Caption = "库存油品"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 3000
TabIndex = 1
Top = 5760
Width = 1815
End
Begin MSDataGridLib.DataGrid dgdKCPD
Bindings = "frmKCPD.frx":452F1
Height = 5535
Left = 0
TabIndex = 0
Top = 0
Width = 11895
_ExtentX = 20981
_ExtentY = 9763
_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 adoKCPD
Height = 375
Left = 9360
Top = 6120
Visible = 0 'False
Width = 1335
_ExtentX = 2355
_ExtentY = 661
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 = "Adodc1"
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 = "frmKCPD"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo myerr
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strUpdate As String
Dim connstring As String
strUpdate = "update PS_Products set 库存 = (select sum(数量) from PS_Purchases where " & _
"油品名称=PS_Products.油品名称) - (select sum(数量) from PS_Sales where " & _
" 油品名称=PS_Products.油品名称)"
connstring = "Provider=SQLOLEDB.1;Password=ecc;Persist Security " _
& "Info=True;User ID=sa;Initial Catalog=PetoleStation System;Server=(local)"
If conn.State <> 1 Then '打开数据库
conn.Open (connstring)
End If
conn.Execute (strUpdate) '执行库存盘点操作
conn.Close
adoKCPD.Refresh '刷新库存
myerr:
End Sub
Private Sub Form_Load()
adoKCPD.CommandType = adCmdText
adoKCPD.RecordSource = "select * from PS_Products"
adoKCPD.Refresh
End Sub
Private Sub Form_Unload(Cancel As Integer)
'将主窗体设置为可用,并将其显示
frmMain.Enabled = True
frmMain.Show
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -