Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

delphi Stored Procedure not Working -

Posted on 2004-04-23
9
Medium Priority
?
218 Views
Last Modified: 2010-04-05
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;
0
Comment
Question by:Mikand
  • 5
6 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 10897959
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 ;-)
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 10898098
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 ; ^
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 10919455
if you need a working example, download it from:
http://www.geocities.com/esoftbg/Q_20964816.zip
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:esoftbg
ID: 10946022
0
 
LVL 12

Accepted Solution

by:
esoftbg earned 500 total points
ID: 11024775
page:        http://www.geocities.com/esoftbg/
link:          Q_20964816.zip
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 11458154
Hi Mikand,
is there any reason that you don't accept a comment above as a solution for your question ?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question