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!

calling a stored proc from within Delphi6

Status
Not open for further replies.

yomyom

Programmer
Dec 23, 2002
119
GB
Dear Delphi people.....
I have tried to call a stored proc that resides in my sql database called master, with a table called yomi.
The stored proc has a parameter called @Name.
When I set the value property of Name parameter in TAdStoredproc1 and run the stored proc within delphi by calling the active property of the stored proc, it gives me an error msg claiming that the value of the parameter is wrong.
I am actually trying to let the stored proc update a table with an Identity field i.e
table yomi: <with fields>
first int identity(50,1),
second char (20).

My stored proc (which works within sql) is :=
create proc prc_New
@Name char (20)
as
insert into yomi (second)
values (@Name)

As you can see, I'm trying 2 use delphi as the front-end for updating my table by allowing the user to supply the value of name :=
AdoStoredProc1.params[0].value = edit1.text;

.....But its not workong !!!!!
Plase help me of you can.
YomYom.
 
Have you actually added the parameter to the TADOStoredProc component? Used the correct name (
Code:
 @Name
)? If so, I can't see why your code shouldn't work. But if the parameter has been added, then you could try it this way:
Code:
with AdoStoredProc1.Parameters do
  begin
    ParamByName('@Name').value := edit1.text;
  end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top