Solved

delphi Stored Procedure not Working -

Posted on 2004-04-23
9
215 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: 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 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month4 days, 23 hours left to enroll

636 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