Link to home
Start Free TrialLog in
Avatar of Mikand
Mikand

asked on

delphi Stored Procedure not Working -

I am currently using Interbase 7.1 and Delphi 7 -- stored procedures have
JUST REFUSED to work for me...

! PS ASSIST...

i have created a simple IB stored procedure (INSERT_DISTRICT) to insert
values into a table (districts) and calling the same from delphi code. In delphi am
also using a data module(dmodstocks) where i have dropeed all my components..

If i call the proceure directly from interbase, i cannot see the values inserted, yet the query executes.

INTERBASE STORED PROC CODE:

SET TERM ^;
CREATE PROCEDURE insert_district
(
insDcode varchar(8),insDname varchar(20)
)
AS
BEGIN
INSERT INTO districts
(districtcode, districtname)
VALUES
(
:insDcode,
:insDname
);
END^

SET TERM ; ^

DELPHI CODE:
procedure TFrmDistrict.BtnSaveClick(Sender: TObject);
begin
Dmodstocks.IBSProcDists.Create(self);

with Dmodstocks.IBSProcDists do begin

Dmodstocks.IBSProcDists.Database := Dmodstocks.IBDBStocks;
StoredProcname := 'INSERT_DISTRICT';

Prepare;

Dmodstocks.IBSProcDists.ParamByName('InsDcode').AsString := DistCodetxt.Text;
Dmodstocks.IBSProcDists.Parambyname('InsDname').AsString := DistNametxt.Text;

ExecProc;
Free;

MessageDlg('A NEW DISTRICT IS REGISTERED! ',mtWarning,[mbok],0);
      distcodetxt.Clear;
      distNameTxt.Clear;
end;

end;
Avatar of kretzschmar
kretzschmar
Flag of Germany image

do you commit your changes?

btw shoudl the proc not show like

CREATE PROCEDURE insert_district
(
insDcode varchar(8),insDname varchar(20)
)
AS
BEGIN
INSERT INTO districts
(districtcode, districtname)
VALUES
(
insDcode,  //<--- without :
insDname  //<--- without :
);

meikl ;-)
SET TERM ^;
CREATE PROCEDURE insert_district
(
insDcode varchar(8),insDname varchar(20)
)
AS
BEGIN
INSERT INTO districts
(districtcode, districtname)
VALUES
(
:insDcode,
:insDname
);
SUSPEND;
END^

SET TERM ; ^
if you need a working example, download it from:
http://www.geocities.com/esoftbg/Q_20964816.zip
ASKER CERTIFIED SOLUTION
Avatar of esoftbg
esoftbg
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Mikand,
is there any reason that you don't accept a comment above as a solution for your question ?