Thinker

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Thinker

Forum for story


    -------button--------

    Aueeins
    Aueeins
    呢喃的歌声


    帖子数 : 205
    积分 : 5229
    威望 : 0
    注册日期 : 2011-09-08
    地点 : SG

    -------button-------- Empty -------button--------

    Post by Aueeins 2011-11-23, 7:08 pm

    Private Sub PostZA_Click()

    ' Call OpenCn(ZAcoy, GSzacoy, False)
    '[/chengwenkai]ST1009-3 1927 24092010
    Dim Con As ADODB.Connection, vRsDateBase As ADODB.Recordset
    Con = New ADODB.Connection
    Call OpenCn(Con, "ZMAIN", False)



    Dim COMNO(5) As String, i As Integer
    COMNO(0) = GScompanyno : COMNO(1) = GScompanyno2 : COMNO(2) = GScompanyno3 : COMNO(3) = GScompanyno4 : COMNO(4) = GScompanyno5
    For i = 0 To 4
    vRsDateBase = New ADODB.Recordset
    vRsDateBase = Con.Execute(" SELECT ZADATABASE FROM ZSOFT WHERE COMPANYNO='" & COMNO(i) & "'")
    If vRsDateBase.EOF = False Then
    Dim CON2 As ADODB.Connection : CON2 = New ADODB.Connection
    Call OpenCn(CON2, vRsDateBase!ZADATABASE & "", False)

    Dim vRsZACOY As ADODB.Recordset
    vRsZACOY = New ADODB.Recordset
    Dim vSqlZACOY As String
    Dim vId, vName, vTel, vFax, vAddr1, vAddS, vAddB, vBill1, vBillS, vBillB As String

    vId = String_Filter(datGSdssbf.Recordset!code)
    vName = String_Filter(datGSdssbf.Recordset!Name)
    vTel = String_Filter(datGSdssbf.Recordset!phone1)
    vFax = String_Filter(datGSdssbf.Recordset!phone2)
    vAddr1 = String_Filter(datGSdssbf.Recordset!addr1)
    vAddS = String_Filter(datGSdssbf.Recordset!addr2)
    vAddB = String_Filter(datGSdssbf.Recordset!addr3)
    vBill1 = String_Filter(datGSdssbf.Recordset!addr1)
    vBillS = String_Filter(datGSdssbf.Recordset!addr2)
    vBillB = String_Filter(datGSdssbf.Recordset!addr3)

    vSqlZACOY = "SELECT * FROM M03COMPANY WHERE ID = '" & vId & "'"
    vRsZACOY = CON2.Execute(vSqlZACOY)

    If vRsZACOY.EOF Then
    vSqlZACOY = "INSERT INTO M03COMPANY (ID, NAME, TELEPHONE, FAX, ADDRESS1, " & _
    "ADDSTREET, ADDBUILDING, BILLADDRESS1, BILLSTREET, BILLBUILDING, SOURCE) " & _
    "VALUES ('" & vId & "', '" & vName & "', '" & vTel & "', '" & _
    vFax & "', '" & vAddr1 & "', '" & vAddS & "', '" & vAddB & "', '" & _
    vBill1 & "', '" & vBillS & "', '" & vBillB & "', 'ZWDS')"
    Else
    vSqlZACOY = "UPDATE M03COMPANY SET NAME = '" & vName & "', TELEPHONE = '" & vTel & "', " & _
    "FAX = '" & vFax & "', " & "ADDRESS1 = '" & vAddr1 & "', SOURCE = 'ZWDS', " & _
    "ADDSTREET = '" & vAddS & "', ADDBUILDING = '" & vAddB & "', " & _
    "BILLADDRESS1 = '" & vBill1 & "', BILLSTREET = '" & vBillS & "', " & _
    "BILLBUILDING = '" & vBillB & "' WHERE ID = '" & vId & "'"
    End If

    CON2.Execute(vSqlZACOY)
    Call CloseCn(CON2)

    'Update the ZACompany field in HPDSSB88
    vSqlZACOY = "UPDATE HPDSSB88 SET ZACOMPANY = 'Y' WHERE CODE = '" & vId & "'"
    HPDbf88.Execute(vSqlZACOY)

    CON2 = Nothing
    End If
    Next

    vRsDateBase.Close() : vRsDateBase = Nothing
    Con.Close() : Con = Nothing

    datGSdssbf.Recordset.Requery()
    datGSdssbf.Recordset.Find("CODE = '" & vId & "'")
    '[/chengwenkai]ST1009-3 1927 24092010
    End Sub

      Current date/time is 2024-11-25, 4:50 pm