kmaku Guest
|
Posted: Mon Apr 19, 2004 7:02 am Post subject: How to use TSQLStoredProc ? |
|
|
---- stored procedure ---------------------------------
CREATE PROCEDURE FeeIncIns(pcardId CHAR(5), pcardId2 CHAR(2), pownCode
INTEGER, pasoCode CHAR(2), pPPLCODE INTEGER
,psChMon DATE, peChMon DATE, pchAmt INTEGER, pfeeType
SMALLINT, pempCode INTEGER,
pIncAmt INTEGER, pIncDate DATE, pTrsDate DATE,
pBookDate DATE, pIncPlc SMALLINT, pRcpNo INTEGER, FEE_TABLE CHAR(6)
, FEE_INC_TABLE CHAR(10))
AS
DECLARE VARIABLE feeNo INTEGER;
BEGIN
WHILE (psChmon<=peChMon) DO
BEGIN
feeNo = GEN_ID(GENFEENO,1);
INSERT INTO FEE_SL (fee_no,card_id, card_id2, aso_code, ppl_code,
ch_mon, ch_amt, fee_type, trt_code, emp_code)
VALUES(:feeNo, :pcardId, :pcardId2, :pasoCode, :pOWNCODE,
:psChMon, :pChAmt, :pFeeType, :pEmpCode, :pEmpCode);
IF (pIncAmt <> 0 ) THEN
BEGIN
INSERT INTO FEE_INC_SL (fee_no, card_id, card_id2, aso_code,
ppl_code, inc_amt, inc_date, trs_date, book_date
, inc_plc, rcp_no)
VALUES (:feeNo, :pcardId, :pcardId2, :pasoCode, :pOWNCODE,
:pIncAmt, :pIncDate, :pTrsDate, :pBookDate, :pIncPlc, :pRcpno);
END
EXECUTE PROCEDURE incMonth :psChMon RETURNING_VALUES :psChMon;
END
END
---- end stored procedure ---------------------------------
------ Use TSQLStroredProc in Del7----------------------------
SSPfeeincins.ParamByName('PCARDID').AsInteger :=
SDSfeeCARDCARD_ID.AsInteger;
SSPfeeincins.ParamByName('PCARDID2').AsInteger :=
SDSfeeCARDCARD_ID2.AsInteger;
SSPfeeincins.ParamByName('POWNCODE').AsInteger :=
SDSfeeCardOWN_CODE.AsInteger;
SSPfeeincins.ParamByName('PASOCODE').Value := DMmain.puAso;
SSPfeeincins.ParamByName('PSCHMON').Value := edtSmon.text +
'-01';
SSPfeeincins.ParamByName('PECHMON').Value := edtEmon.text +
'-01';
SSPfeeincins.ParamByName('PCHAMT').Value :=
KXedtChAmt.AsInteger;
SSPfeeincins.ParamByName('PFEETYPE').Value :=
DBCBfeeType.KeyValue;
SSPfeeincins.ParamByName('PEMPCODE').Value := DMmain.puEmp;
SSPfeeincins.ParamByName('PINCAMT').Value :=
edtIncAmt.AsInteger;
SSPfeeincins.ParamByName('PINCDATE').Value := edtIncDate.Text;
SSPfeeincins.ParamByName('PTRSDATE').Value := edtTrsDate.Text;
SSPfeeincins.ParamByName('PBOOKDATE').Value := edtBookDate.Text;
SSPfeeincins.ParamByName('PINCPLC').Value :=
DBCBIncPlc.KeyValue;
SSPfeeincins.ParamByName('PRCPNO').Value := edtRctNo.Text;
try
SSPfeeincins.ExecProc(); <---- this occur error! (Operation
Not Supported)
Action := caFree;
except
Application.MessageBox(' error
','error',MB_OK+MB_ICONERROR);
Action := caNone;
end; //try ... except
-----------------------------------------------------
I want to execute Stored Procedure using TSQLStoredProc Components.. but I
doesn't work well..
First of all, Because this stored procedure can not return anything, so I
did not use 'Action := True' OR 'Open' ...
As I know at this case must use ExecProc method... so I did.. but It also
occur error like "Operation not supported"
which I have seen when try to navigate with directional dataset.
What is the problem?
thanks ...
|
|