Solved

delphi Stored Procedure not Working -

Posted on 2004-04-23
9
209 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
9 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 12

Expert Comment

by:esoftbg
ID: 10946022
0
 
LVL 12

Accepted Solution

by:
esoftbg earned 125 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now