📄 clstakeout.cls
字号:
Version 1.0 Class
Begin
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
End
Attribute VB_Name = "ClsTakeOut"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public TakeOutID As String
Public TakeOutType As String
Public Item As String
Public UnitPrice As String
Public Currency1 As String
Public Qty As String
Public StoreRoom As String
Public Location As String
Public FillinPerson As String
Public FillinTime As String
Public Sub UpdateStore(ByVal OriItem As String, ByVal CutQty As Integer, ByVal OriStoreRoom As String, ByVal OriLocation As String)
'连接数据库
MyDB.openDB
'设置Select语句
SqlStmt = "select Qty from Store where Item='" + Trim(OriItem) + "' and StoreRoom='" + Trim(OriStoreRoom) + "' and Location='" + Trim(OriLocation) + "' "
'执行SQL语句
Dim Isexe As Boolean
Dim rsQty As ADODB.Recordset
Isexe = MyDB.exeSql(SqlStmt, rsQty, False)
Dim OriQty As Integer
Dim NowQty As Integer
OriQty = Trim(rsQty.Fields(0))
NowQty = OriQty - CutQty
'设置Update语句
SqlStmt = "Update Store Set Qty='" + Trim(NowQty) + "' WHERE Item='" + Trim(OriItem) + "' and StoreRoom='" + Trim(OriStoreRoom) + "' and Location='" + Trim(OriLocation) + "'"
'执行SQL语句
Dim rsStore As ADODB.Recordset
Isexe = MyDB.exeSql(SqlStmt, rsStore, True)
'断开与数据库的连接
MyDB.closeDB
End Sub
Public Sub OutStore(ByVal TempItem As String, ByVal OriStoreRoom As String, ByVal OriLocation As String)
'连接数据库
MyDB.openDB
'设置Insert语句
SqlStmt = "Delete FROM Store WHERE Item='" + Trim(TempItem) + "' and StoreRoom='" + Trim(OriStoreRoom) + "' and Location='" + Trim(OriLocation) + "' "
'执行SQL语句
Dim Isexe As Boolean
Dim rsStore As ADODB.Recordset
Isexe = MyDB.exeSql(SqlStmt, rsStore, True)
'断开与数据库的连接
MyDB.closeDB
End Sub
Public Sub Insert()
'连接数据库
MyDB.openDB
'设置Insert语句
SqlStmt = "INSERT INTO TakeOut (TakeOutID,TakeOutType,Item,UnitPrice,Currency1,Qty,StoreRoom,Location,FillinPerson,FillinTime)" _
+ " Values('" + Trim(TakeOutID) + "','" + Trim(TakeOutType) + "','" + Trim(Item) + "','" + Trim(UnitPrice) _
+ "','" + Trim(Currency1) + "','" + Trim(Qty) _
+ "','" + Trim(StoreRoom) _
+ "','" + Trim(Location) + "','" + Trim(FillinPerson) + "','" + Trim(FillinTime) + "')"
'执行SQL语句
Dim Isexe As Boolean
Dim rsTakeOut As ADODB.Recordset
Isexe = MyDB.exeSql(SqlStmt, rsTakeOut, True)
'断开与数据库的连接
MyDB.closeDB
End Sub
Public Function In_DB(ByVal TempTakeOutID As String) As Boolean
'连接数据库
MyDB.openDB
'设置查询语句
SqlStmt = "SELECT TakeOutID FROM TakeOut WHERE TakeOutID=" + Trim(TempTakeOutID) + ""
'执行SQL语句
Dim Isexe As Boolean
Dim rsTakeOut As ADODB.Recordset
Isexe = MyDB.exeSql(SqlStmt, rsTakeOut, False)
'判断是否存在
If rsTakeOut.RecordCount <> 0 Then
In_DB = True
Else
In_DB = False
End If
'断开与数据库的连接
MyDB.closeDB
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -