List Index Out of Bound(0) error

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
Khoaster
Posts: 1
Joined: Fri 24 Oct 2008 18:56

List Index Out of Bound(0) error

Post by Khoaster » Fri 24 Oct 2008 19:07

Recently I ran into an error using dbExpress’ SQLStoredProc component in Delphi 7. I got this error in the code after I called a stored procedure (where I expect a @return_value). I don’t have the same problem when I use SQL Server 2005 on the same PC with my EXE (it works fine); but when I run the EXE from a client PC I would get this error. I searched around online and I got a few suggestions like this “This is a known bug. I just went through this. Get the Corelab driver. It works as expected”. I downloaded the latest dbxsda425 (to replace my dbxsda420) but the problem didn't go away. I checked my MDAC on all my PCs and they are the latest version also.

The following is a sample of my code.
In Delphi: (dbExpProcessPayment is dbExpress' SQLStoredProc component)
-----------
try
dbExpProcessPayment.Close;
dbExpProcessPayment.StoredProcName := 'spAddBatchPayment';
dbExpProcessPayment.Params[1].Value := tmpBatchID;
dbExpProcessPayment.Params[2].Value := dmABS.ABSUserID;
try
dbExpProcessPayment.ExecProc;
except
on E: Exception do //write to error log
Showmessage('Error occurs while creating a new batch payment!');
end; //except
finally

wwDBCBatch_No.Value := dbExpProcessPayment.Params[0].Value;
End;

The stored procedure spAddBatchPayment in SQL Server:
------------------------------------------------------------------
CREATE PROCEDURE spAddBatchPayment
@BatchPaymentID varchar(14), @UserID varchar(25) AS
BEGIN
INSERT INTO Batch_Payment (Batch_Payment_ID, Create_Date_Time, Created_By)
VALUES (@BatchPaymentID, GETDATE(), @UserID)

RETURN @@IDENTITY
END

Could someone give me a suggestion? Thank you for your help.

Post Reply