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.Cr eate(self) ;
with Dmodstocks.IBSProcDists do begin
Dmodstocks.IBSProcDists.Da tabase := Dmodstocks.IBDBStocks;
StoredProcname := 'INSERT_DISTRICT';
Prepare;
Dmodstocks.IBSProcDists.Pa ramByName( 'InsDcode' ).AsString := DistCodetxt.Text;
Dmodstocks.IBSProcDists.Pa rambyname( 'InsDname' ).AsString := DistNametxt.Text;
ExecProc;
Free;
MessageDlg('A NEW DISTRICT IS REGISTERED! ',mtWarning,[mbok],0);
distcodetxt.Clear;
distNameTxt.Clear;
end;
end;
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(
begin
Dmodstocks.IBSProcDists.Cr
with Dmodstocks.IBSProcDists do begin
Dmodstocks.IBSProcDists.Da
StoredProcname := 'INSERT_DISTRICT';
Prepare;
Dmodstocks.IBSProcDists.Pa
Dmodstocks.IBSProcDists.Pa
ExecProc;
Free;
MessageDlg('A NEW DISTRICT IS REGISTERED! ',mtWarning,[mbok],0);
distcodetxt.Clear;
distNameTxt.Clear;
end;
end;
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 ; ^
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
http://www.geocities.com/esoftbg/Q_20964816.zip
excuse my mistake:
http://www.geocities.com/esoftbg/ee/Q_20964816.zip
http://www.geocities.com/esoftbg/ee/Q_20964816.zip
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Mikand,
is there any reason that you don't accept a comment above as a solution for your question ?
is there any reason that you don't accept a comment above as a solution for your question ?
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 ;-)