原 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 的錯誤出現
沒有留言:
張貼留言