Updating a record with stored procedure not working

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
glen
Posts: 2
Joined: Sat 09 Aug 2008 16:12

Updating a record with stored procedure not working

Post by glen » Sun 10 Aug 2008 15:50

I am attempting to update a record using a stored procedure with a TIBCStoredProc component. The update procedure I wrote works when I execute it at the database level. I have notice I need to execute a commit after running it though. But when I execute the same stored procedure from Delphi it appears it never gets committed. Autocommit on the componet is set to true. Process runs with no errors. Thanks

Interbase 2007
Delphi CodeGear™ RAD Studio 2007 Version 11.0.2902.10471
IBDAC 2.50.0.36 for RAD Studio 2007

OS
Windows Vista 32 bit Home Premium Serveice Pack 1


***strored procedure******

create procedure SET_INVOICE_ORDERS(I_Invoice_ID INTEGER, I_Client_ID INTEGER, D_InvoiceStartDate DATE,

D_InvoiceEndtDate DATE )

AS

begin
/* Procedure Text */
UPDATE ORDERS
SET Invoice_ID = :I_Invoice_ID
WHERE
PERMANENT = True AND
ORDER_DATE >= :D_InvoiceStartDate AND
ORDER_DATE <= :D_InvoiceEndtDate AND
CLIENT_ID = :I_CLIENT_ID AND
INVOICE_ID IS NULL AND
VOID = False;
end;


*******Delphi code*******************************

//update the orders table with the invoice number
spSetInvoiceOrders.Prepare;
spSetInvoiceOrders.ParamByName('I_Invoice_ID').AsInteger:= NewInvoiceID;
spSetInvoiceOrders.ParamByName('I_Client_ID').AsInteger:= TheClientID;
spSetInvoiceOrders.ParamByName('D_InvoiceStartDate').AsDate:= dtpStartDate.Date;
spSetInvoiceOrders.ParamByName('D_InvoiceStartDate').AsDate:= dtpEndDate.Date;
spSetInvoiceOrders.ExecProc;

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 13 Aug 2008 07:25

Please check that the AutoCommit property of the TIBCConnection component is also set to True.

glen
Posts: 2
Joined: Sat 09 Aug 2008 16:12

Post by glen » Wed 13 Aug 2008 23:03

Auto commit was set to true on the connect component.

any other ideas? Thanks

glen

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 15 Aug 2008 06:52

We could not reproduce the problem. Please send to ibdac*devart*com a complete small sample that demonstrates the problem, including the script for creating database objects.

Post Reply