Solved

delphi Stored Procedure not Working -

Posted on 2004-04-23
9
211 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

785 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