⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modinsertdata.bas

📁 一套简易的MIS系统。带SQLServer数据库。供参考。
💻 BAS
📖 第 1 页 / 共 2 页
字号:
Attribute VB_Name = "modInsertData"
'----------------------------------------------------------------------------------------------------
'
'
'                数据操作
'
'                日期:2006年6月
'
'                代码编写:王懿岩
'
'
'----------------------------------------------------------------------------------------------------
'1、添加库房信息(附带修改)
Public Function tLPGStation(uInfo As tShareInfo, iUP_ADD As Integer) As Boolean
    
    Dim iAff             As Integer
    tLPGStation = False
    On Error GoTo ErrInfo
    DBCN.BeginTrans
    Select Case iUP_ADD
        Case 0           '添加
            DBCN.Execute "Insert Into tbCcStation(StaCode,StaName,StaAddress,Stalink_Man,Stalink_Tel) " _
                        & " Select '" & uInfo.strCode & "','" & uInfo.strName & "','" & uInfo.strShare & "', " _
                        & " '" & uInfo.isgShare1 & "','" & uInfo.strType & "' ", iAff
            If iAff <> 1 Then
                DBCN.RollbackTrans
                tLPGStation = False
                MsgBox "数据添加失败!", vbInformation, "提示:"
                Exit Function
            End If
        Case 1           '修改
            DBCN.Execute "Update tbCcStation Set StaName='" & uInfo.strName & "',StaAddress='" & uInfo.strShare & "', " _
                        & " Stalink_Man='" & uInfo.strShare1 & "',Stalink_Tel='" & uInfo.strType & "' Where " _
                        & " StaCode='" & uInfo.strCode & "' ", iAff
            If iAff <> 1 Then
                DBCN.RollbackTrans
                tLPGStation = False
                MsgBox "数据处理失败!", vbInformation, "提示:"
                Exit Function
            End If
    End Select
    DBCN.CommitTrans
    tLPGStation = True
    Exit Function
ErrInfo:
    DBCN.RollbackTrans
    tLPGStation = False
    MsgBox Err.Description, vbInformation, "提示:"
End Function

'2、添加修改客户信息
Public Function tCSTInfo(uInfo As tShareInfo, iUP_ADD As Integer) As Boolean
    
    Dim iAff               As Integer
    tCSTInfo = False
    On Error GoTo ErrInfo
    DBCN.BeginTrans
    Select Case iUP_ADD
        Case 0                  '添加
            DBCN.Execute "Insert Into tbCcCust(Cust_id,Cust_name,Cust_zjm,Cust_Addres,Link_man,Cust_tel,Remark,Cust_sort," _
                        & " Oper_id,Oper_date,Instate) Select '" & uInfo.strCode & "','" & uInfo.strName & "', " _
                        & " '" & uInfo.strShare3 & "','" & uInfo.strShare & "','" & uInfo.strShare1 & "','" & uInfo.strShare2 & "'," _
                        & " '" & uInfo.strType & "'," & uInfo.intFlag & ",'" & strOprCode & "','" & uInfo.dInDate & "', " _
                        & " " & uInfo.intFlag1 & "", iAff
            If iAff <> 1 Then
                DBCN.RollbackTrans
                tCSTInfo = False
                MsgBox "数据添加失败!", vbInformation, "提示:"
                Exit Function
            End If
        Case 1                  '修改
            DBCN.Execute "Update tbCCCust Set Cust_name='" & uInfo.strName & "',Cust_Addres='" & uInfo.strShare & "', " _
                        & " Link_Man='" & uInfo.strShare1 & "',Cust_Tel='" & uInfo.strShare2 & "', " _
                        & " Remark='" & uInfo.strType & "',Cust_Sort=" & uInfo.intFlag & ",Oper_ID='" & strOprCode & "'," _
                        & " Oper_Date='" & uInfo.dInDate & "',InState=" & uInfo.intFlag1 & ",Cust_zjm='" & uInfo.strShare3 & "' Where " _
                        & " Cust_ID='" & uInfo.strCode & "' ", iAff
            If iAff <> 1 Then
                DBCN.RollbackTrans
                tCSTInfo = False
                MsgBox "数据操作失败!", vbInformation, "提示:"
                Exit Function
            End If
    End Select
    DBCN.CommitTrans
    tCSTInfo = True
    Exit Function
ErrInfo:
    DBCN.RollbackTrans
    tCSTInfo = False
    MsgBox Err.Description, vbInformation, "提示:"
    
End Function

'3、车辆添加和修改
Public Function tCarInfo(uInfo As tShareInfo, iUP_ADD As Integer) As Boolean
    
    Dim iAff           As Integer
    tCarInfo = False
    On Error GoTo ErrInfo
    DBCN.BeginTrans
    Select Case iUP_ADD
        Case 0               '添加
            DBCN.Execute "Insert Into tbCCCar(Car_id,Cust_id,Car_weigh,Car_carry,Car_photo,Car_path," _
                        & " Oper_id,Oper_date,Instate) Select '" & uInfo.strCode & "','" & uInfo.strName & "'," _
                        & " " & uInfo.isgShare & "," & uInfo.isgShare1 & ",'" & uInfo.picInfo.Picture & "','" & uInfo.strShare & "' ," _
                        & " '" & strOprCode & "','" & uInfo.dInDate & "'," & uInfo.intFlag & " ", iAff
            If iAff <> 1 Then
                DBCN.RollbackTrans
                tCarInfo = False
                MsgBox "数据添加失败!", vbInformation, "提示:"
                Exit Function
            End If
        Case 1               '修改
            DBCN.Execute "Update tbCCCar Set Cust_ID='" & uInfo.strName & "',Car_Weigh=" & uInfo.isgShare & ",Car_Carry=" & uInfo.isgShare1 & "," _
                        & " Car_Photo='" & uInfo.picInfo.Picture & "',Car_path='" & uInfo.strShare & "',Oper_id='" & strOprCode & "'," _
                        & " Oper_date='" & uInfo.dInDate & "',Instate=" & uInfo.intFlag & " Where Car_ID='" & uInfo.strCode & "' ", iAff
            If iAff <> 1 Then
                DBCN.RollbackTrans
                tCarInfo = False
                MsgBox "数据操作失败!", vbInformation, "提示:"
                Exit Function
            End If
    End Select
    DBCN.CommitTrans
    iAdd_Update = 0
    tCarInfo = True
    Exit Function
ErrInfo:
    DBCN.RollbackTrans
    tCarInfo = False
    MsgBox Err.Description, vbInformation, "提示:"
    
End Function

'4、供货商信息
Public Function tShopInfo(uInfo As tShareInfo, iUP_ADD As Integer) As Boolean
    
    Dim iAff              As Integer
    tShopInfo = False
    On Error GoTo ErrInfo
    DBCN.BeginTrans
    Select Case iUP_ADD
        Case 0                '添加
            DBCN.Execute "Insert Into tbCCProd(Prod_id,Prod_name,Prod_addres,Prod_tel,Link_man,Remark,Oper_id,Oper_date,Instate) " _
                        & " Select '" & uInfo.strCode & "','" & uInfo.strName & "','" & uInfo.strShare & "','" & uInfo.strShare1 & "'," _
                        & " '" & uInfo.strShare2 & "','" & uInfo.strType & "','" & strOprCode & "','" & uInfo.dInDate & "'," & uInfo.intFlag & " ", iAff
            If iAff <> 1 Then
                DBCN.RollbackTrans
                tShopInfo = False
                MsgBox "数据添加失败!", vbInformation, "提示:"
                Exit Function
            End If
        Case 1                '修改
            DBCN.Execute "Update tbCCProd Set Prod_name='" & uInfo.strName & "',Prod_addres='" & uInfo.strShare & "',Prod_tel='" & uInfo.strShare1 & "'," _
                        & " Link_man='" & uInfo.strShare2 & "',Remark='" & uInfo.strType & "',Oper_id='" & strOprCode & "',Oper_date='" & uInfo.dInDate & "', " _
                        & " Instate=" & uInfo.intFlag & " Where Prod_ID='" & uInfo.strCode & "' ", iAff
            If iAff <> 1 Then
                DBCN.RollbackTrans
                tShopInfo = False
                MsgBox "数据操作失败!", vbInformation, "提示:"
                Exit Function
            End If
    End Select
    DBCN.CommitTrans
    tShopInfo = True
    Exit Function
ErrInfo:
    DBCN.RollbackTrans
    tShopInfo = False
    MsgBox Err.Description, vbInformation, "提示:"
End Function

'5、付款类型
Public Function tPayTypeInfo(uInfo As tShareInfo, iUP_ADD As Integer) As Boolean
    
    Dim iAff            As Integer
    tPayTypeInfo = False
    On Error GoTo ErrInfo
    DBCN.BeginTrans
    Select Case iUP_ADD
        Case 0               '添加
            DBCN.Execute "Insert Into tbCCPaySort(PaySort_id,PaySort_name,Oper_id,Oper_date,Instate) Select '" & uInfo.strCode & "', " _
                        & " '" & uInfo.strName & "','" & strOprCode & "','" & uInfo.dInDate & "'," & uInfo.intFlag & " ", iAff
            If iAff <> 1 Then
                DBCN.RollbackTrans
                tPayTypeInfo = False
                MsgBox "数据添加失败!", vbInformation, "提示:"
                Exit Function
            End If
        Case 1               '修改
            DBCN.Execute "Update tbCCPaySort Set PaySort_name='" & uInfo.strName & "',Oper_id='" & strOprCode & "',Oper_date='" & uInfo.dInDate & "'," _
                        & " Instate=" & uInfo.intFlag & " Where PaySort_id='" & uInfo.strCode & "'", iAff
            If iAff <> 1 Then
                DBCN.RollbackTrans
                tPayTypeInfo = False
                MsgBox "数据操作失败!", vbInformation, "提示:"
                Exit Function
            End If
    End Select
    DBCN.CommitTrans
    tPayTypeInfo = True
    Exit Function
ErrInfo:
    DBCN.RollbackTrans
    tPayTypeInfo = False
    MsgBox Err.Description, vbInformation, "提示:"
    
End Function

'6、物品类型
Public Function tMatType(uInfo As tShareInfo, iUP_ADD As Integer) As Boolean
    
    Dim iAff              As Integer
    tMatType = False
    On Error GoTo ErrInfo
    DBCN.BeginTrans
    Select Case iUP_ADD
        Case 0              '添加
            DBCN.Execute "Insert Into tbCCGoods(Goods_id,Goods_name,Goods_unit,Goods_spec,Oper_id,Oper_date,Instate) " _
                        & " Select '" & uInfo.strCode & "','" & uInfo.strName & "','" & uInfo.strShare & "'," _
                        & " '" & uInfo.strShare1 & "','" & strOprCode & "','" & uInfo.dInDate & "'," & uInfo.intFlag & " ", iAff
            If iAff <> 1 Then
                DBCN.RollbackTrans
                tMatType = False
                MsgBox "数据添加失败!", vbInformation, "提示:"
                Exit Function
            End If
        Case 1              '修改
            DBCN.Execute "Update tbCCGoods Set Goods_name='" & uInfo.strName & "', Goods_unit='" & uInfo.strShare & "',Goods_spec='" & uInfo.strShare1 & "'," _
                        & " Oper_id='" & strOprCode & "',Oper_date='" & uInfo.dInDate & "',Instate=" & uInfo.intFlag & " " _
                        & " Where Goods_ID='" & uInfo.strCode & "' ", iAff
            If iAff <> 1 Then
                DBCN.RollbackTrans
                tMatType = False
                MsgBox "数据添加失败!", vbInformation, "提示:"
                Exit Function
            End If
    End Select
    DBCN.CommitTrans
    tMatType = True
    Exit Function
ErrInfo:
    DBCN.RollbackTrans
    tMatType = False
    MsgBox Err.Description, vbInformation, "提示:"
    
End Function

'7、返回
Public Function tBackMain(frmInfo As Form)
    
    On Error GoTo ErrInfo
    
    Unload frmInfo
    
    Exit Function
ErrInfo:
    MsgBox Err.Description, vbInformation, "提示:"
End Function

'8、计算窗体位置
Public Function tFormSpace(frmInfo As MDIForm, frmList As Form, uInfo As tWindwos)
    
    With frmList
        .Top = frmInfo.Height / 2 - .Height / 2 - uInfo.iTop

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -