Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

call an sql stored procedure from delphi 6

Status
Not open for further replies.

yomyom

Programmer
Dec 23, 2002
119
GB
Dear delphi lovers,
I have a stored procedure on my MS-SQL Dataabase as follows:
create proc prc_New
@Name char(20)
as
begin
insert into yomi (second)
values (@Name)
end

the purpose of this stored procedure is to grab the text in an edit box and insert it into the table named yomi in the Medical database. The table is defined as follows:
create table yomi
(first int Identity(50,1),
second char(20))

The identity key word enables the table.yomi's first field to have its value automatically updated by the system each time the user inserts a new row( starting from the value 50).

The Problem:
When I call the stored procedure from delphi6, it gives me an error....<...incorrect value....>.
Can anyone tell me the correct way to call an MS-SQL stored procedure from within delphi6 when the MS-SQL stored procedure has parameters that :
1. Don't return values.
2. Do return values.

I look forward 2 being helped. P.s sorry its a long winded question ( I want 2 be understood).
yomyom.
 
Hi

This proc don't return a value.

procedure TForm1.Button1Click(Sender: TObject);
begin
q1.SQL.Clear;
q1.SQL.Text := 'exec prc_New ' + edit1.Text;
q1.ExecSQL;
end;

-Kudel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top