clscustomerprice.cls
来自「很好! 很实用! 免费!」· CLS 代码 · 共 175 行
CLS
175 行
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "clsCustomerPrice"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'***************************************************************
'CoCustomerPrice类模块
'CreateTime:2002-11-10 2:21:14;Editor:RZHOU
'ComputerIP:192.168.3.252;ComputerName:bluepc
'***************************************************************
Option Explicit
'*****************************************
Public m_ID As String 'DBO.CoCustomerPrice.ID;描述:;主键
Public m_CustomerID As String 'DBO.CoCustomerPrice.CustomerID;描述:;
Public m_CommodityID As String 'DBO.CoCustomerPrice.CommodityID;描述:;
Public m_Price1 As Double 'DBO.CoCustomerPrice.Price1;描述:;
Public m_Price2 As Double 'DBO.CoCustomerPrice.Price2;描述:;
Public m_Schedule As Long 'DBO.CoCustomerPrice.Schedule;描述:;
Public m_OperatorID As String 'DBO.CoCustomerPrice.OperatorID;描述:;记录操作人的ID,从模块中的g_sUserID得到
Private m_CreateDate As Date 'DBO.CoCustomerPrice.CreateDate;描述:;记录加入的时间,在Insert的时候取值getDate(),在Update的时候不用修改
Private m_ModifyDate As Date 'DBO.CoCustomerPrice.ModifyDate;描述:;记录最后修改的时间,在Insert的时候取值getDate(),在Update的时候也取值getDate()
'*****************************************
Dim sSQL As String
'CoCustomerPrice Templet在给对象赋值时使用,可以少写不少代码...
'Public function Templet() as boolean
'On Error Resume Next
'.m_ID=""
'.m_CustomerID=""
'.m_CommodityID=""
'.m_Price1=""
'.m_Price2=""
'.m_Schedule=""
'.m_OperatorID=""
'.m_CreateDate=""
'.m_ModifyDate=""
'End Function
'修改数据开始
'CoCustomerPrice Insert SQL
Public Function Insert() As Boolean
On Error Resume Next
sSQL = ""
sSQL = sSQL + " insert into CoCustomerPrice"
sSQL = sSQL + " ("
sSQL = sSQL + "ID,CustomerID,CommodityID,Price1,Price2,Schedule,OperatorID,CreateDate,ModifyDate"
sSQL = sSQL + ") Values ("
sSQL = sSQL + CheckString(m_ID) + ","
sSQL = sSQL + CheckString(m_CustomerID) + ","
sSQL = sSQL + CheckString(m_CommodityID) + ","
sSQL = sSQL + "convert(Float," + CheckString(m_Price1) + ")" + ","
sSQL = sSQL + "convert(Float," + CheckString(m_Price2) + ")" + ","
sSQL = sSQL + CStr(m_Schedule) + ","
sSQL = sSQL + CheckString(g_sUserID) + ","
sSQL = sSQL + "getDate()" + ","
sSQL = sSQL + "getDate()"
sSQL = sSQL + ")"
g_cn.BeginTrans
g_cn.Execute sSQL
If Err.Number = 0 Then
g_cn.CommitTrans
'Add Log*********************'
g_System.AddLog "CoCustomerPrice", sSQL
Insert = True
Else
g_cn.RollbackTrans
Insert = False
Err.Clear
End If
End Function
'CoCustomerPrice Update SQL
Public Function Update() As Boolean
On Error Resume Next
sSQL = ""
sSQL = sSQL + " update CoCustomerPrice Set "
sSQL = sSQL + "CustomerID=" + CheckString(m_CustomerID) + ","
sSQL = sSQL + "CommodityID=" + CheckString(m_CommodityID) + ","
sSQL = sSQL + "Price1=" + "convert(Float," + CheckString(m_Price1) + ")" + ","
sSQL = sSQL + "Price2=" + "convert(Float," + CheckString(m_Price2) + ")" + ","
sSQL = sSQL + "Schedule=" + CStr(m_Schedule) + ","
sSQL = sSQL + "OperatorID=" + CheckString(g_sUserID) + ","
sSQL = sSQL + "ModifyDate=" + "getDate()"
sSQL = sSQL + " where ID=" + CheckString(m_ID)
g_cn.BeginTrans
g_cn.Execute sSQL
If Err.Number = 0 Then
g_cn.CommitTrans
'Add Log*********************'
g_System.AddLog "CoCustomerPrice", sSQL
Update = True
Else
g_cn.RollbackTrans
Update = False
Err.Clear
End If
End Function
'CoCustomerPrice Delete SQL
Public Function Delete() As Boolean
On Error Resume Next
sSQL = ""
sSQL = sSQL + " Delete CoCustomerPrice where ID=" + CheckString(m_ID)
g_cn.BeginTrans
g_cn.Execute sSQL
If Err.Number = 0 Then
g_cn.CommitTrans
'Add Log*********************'
g_System.AddLog "CoCustomerPrice", sSQL
Delete = True
Else
g_cn.RollbackTrans
Delete = False
Err.Clear
End If
End Function
'CoCustomerPrice Fill By ID SQL ,根据ID填充本对象
'参数 iID:对象的ID值
Public Function FillByID(ByVal sID As String) As Boolean
Dim rsTemp As ADODB.Recordset
Set rsTemp = New ADODB.Recordset
sSQL = ""
sSQL = sSQL + " Select * from CoCustomerPrice where ID=" + CheckString(sID)
rsTemp.Open sSQL, g_cn
If rsTemp.RecordCount > 0 Then
m_ID = rsTemp.Fields("ID").value
m_CustomerID = rsTemp.Fields("CustomerID").value
m_CommodityID = rsTemp.Fields("CommodityID").value
m_Price1 = rsTemp.Fields("Price1").value
m_Price2 = rsTemp.Fields("Price2").value
m_Schedule = rsTemp.Fields("Schedule").value
m_OperatorID = rsTemp.Fields("OperatorID").value
m_CreateDate = rsTemp.Fields("CreateDate").value
m_ModifyDate = rsTemp.Fields("ModifyDate").value
FillByID = True
Else
FillByID = False
End If
End Function
'CoCustomerPrice get List Recordset SQL,根据条件返回本数据库的记录集
'参数 sFields:查找到的记录集的字段列表;sWhere:找到记录的条件;sOrder:记录集的排序字段及方式
Public Function GetList(Optional ByVal sFields As String = "*", Optional ByVal sWhere As String = "", Optional ByVal sOrder As String = "") As Recordset
Dim rsTemp As ADODB.Recordset
Set rsTemp = New ADODB.Recordset
sSQL = ""
sSQL = sSQL + " Select " + sFields + " from CoCustomerPrice"
If Len(sWhere) > 0 Then
sSQL = sSQL + " where " + sWhere
End If
If Len(sOrder) > 0 Then
sSQL = sSQL + " Order by " + sOrder
End If
rsTemp.Open sSQL, g_cn
Set GetList = rsTemp
End Function
'CoCustomerPrice get Recordset By ID SQL,根据ID返回本数据库的记录集
'参数 iID:对象的ID值;sFields:查找到的记录集的字段列表;sOrder:记录集的排序字段及方式
Public Function GetRecordsetByID(ByVal sID As String, Optional ByVal sFields As String = "*", Optional ByVal sOrder As String = "") As ADODB.Recordset
Dim rsTemp As ADODB.Recordset
Set rsTemp = New ADODB.Recordset
sSQL = ""
sSQL = sSQL + " Select " + sFields + " from CoCustomerPrice where ID=" + CheckString(sID)
If Len(sOrder) > 0 Then
sSQL = sSQL + " Order by " + sOrder
End If
rsTemp.Open sSQL, g_cn
Set GetRecordsetByID = rsTemp
End Function
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?