星期四, 11月 22, 2018

[VFP] C0000005 錯誤訊息

遇上 VFP 最讓人討厭的 C0000005 錯誤,好家在有迅速破案,不過在測試階段正常,上線後一段時間才跳出來,也是頗讓人討厭,Orz

[VFP] C0000005 錯誤訊息

原 VFP 寫法
SELECT 
    S.NOs , 
    D.* ;
FROM curSequence AS S 
    LEFT JOIN BonusAccDetail AS D With (Buffering = .T.) ON ALLTRIM(S.BonusTitle) == ALLTRIM(D.BonusTitle) AND 
                                                            Alltrim(D.CompNO) == lcCompNO AND 
                                                            Alltrim(D.EmpNO) == lcEmpNO AND 
                                                            ALLTRIM(AccWay) == lcAccWay ;
    INTO Cursor curEmployData
修正為,先把 BonusAccDetail 所需資料抓進暫存 Cursor,之後再去跟 curSequence cursor 合併
SELECT * FROM BonusAccDetail With (Buffering = .T.) ;
    WHERE Alltrim(CompNO) == lcCompNO AND 
          Alltrim(EmpNO) == lcEmpNO And 
          Alltrim(AccWay) == lcAccWay ;
    INTO Cursor curBonusAccDetailTemp

Select S.NOs , D.* ;
    FROM curSequence As S Left Join curBonusAccDetailTemp As D On Alltrim(S.BonusTitle) == Alltrim(D.BonusTitle) ;
    INTO Cursor curEmployData

Use In Select("curBonusAccDetailTemp")
透過上述修改就避開 C0000005 的錯誤出現

沒有留言:

張貼留言