Reputation: 113
i created a stored procedure on sql server for updating records,while there it works fine when I insert the required parameters... but when it comes to ASP .NET when I run the application when I press update on ASPX GridView it gives me a Message "Procedure or function custUPDATE has too many arguments specified."
here is the code for my procedure
alter proc custUPDATE
( @odid int,
@customer_id int,
@priceID int,
@etAMOUNT int,
@amntPaid decimal(18,2),
@od_status varchar(20),
@py_status varchar(20),
@order_date smalldatetime
-- @dummy varchar(30) =null
)
as
begin
set nocount on;
declare @amnt_paid decimal(18,2);
declare @rmn decimal(23,4);
declare @tt money;
select @amnt_paid=eggsOrders.amnt_paid from eggsOrders where od_ID=@odid;
select @rmn= orderVIEW.Remaining from orderVIEW where od_ID=@odid;
select @tt=orderVIEW.Total from orderVIEW where od_ID=@odid;
--select @amnt_paid= amnt_paid from inserted;
if(@amnt_paid=@tt)
begin
update [dbo].[eggsOrders] set customer_ID=@customer_id, price_ID=@priceID, ET_amount=@etAMOUNT, amnt_paid=@amntPaid, Od_status=@od_status, py_status='paid in full', order_date=@order_date where od_ID=@odid;
end
else if(@amnt_paid>0 and @amnt_paid!=@tt)
begin
update [dbo].[eggsOrders] set customer_ID=@customer_id, price_ID=@priceID, ET_amount=@etAMOUNT, amnt_paid=@amntPaid, Od_status=@od_status, py_status='In-Progress', order_date=@order_date where od_ID=@odid
end
else if(@amnt_paid=0 and @rmn =@tt)
begin
update [dbo].[eggsOrders] set customer_ID=@customer_id, price_ID=@priceID, ET_amount=@etAMOUNT, amnt_paid=@amntPaid, Od_status=@od_status, py_status='Payment Pending', order_date=@order_date where od_ID=@odid
end
end
go
what am I doing wrong??? please help
Upvotes: 0
Views: 50
Reputation: 13990
The error is cristal clear: you're passing more parameters to the method than what it expect, causing the error. Review carefully how many parameters are you passing in the call to SP.
Upvotes: 1
Reputation: 1
I’ve noticed occasionally that ASP.NET will cache the old SPROC in Visual Studio even after a change is made on SQL Server. So for example you changed custUPDATE by adding a parameter, and also added the parameter to your ASP.NET code, but are still receiving the “too many arguemtns specified” error because the old SPROC is being cached.
If this is the case I would try the following:
Change the SPROC name in your ASP.NET page from custUPDATE to [custUPDATE] and then try running it.
Upvotes: 0