存储过程和asp.net



我在sql server上创建了一个用于更新记录的存储过程,当我插入所需参数时,它可以正常工作…但是当涉及到asp.net时,当我运行应用程序时,当我在ASPX GridView上按下更新时,它会给我一条消息"过程或函数custUPDATE指定了太多参数。"

下面是程序

的代码
   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

我做错了什么?请帮助

这个错误非常明显:您传递给方法的参数比它期望的要多,从而导致了错误。仔细检查在SP的调用中传递了多少参数

我偶尔注意到ASP。. NET将在Visual Studio中缓存旧的SPROC,即使在SQL Server上进行了更改。例如,您通过添加参数来更改custUPDATE,并将参数添加到ASP中。. NET代码,但仍然收到"指定的参数太多"错误,因为旧的SPROC正在被缓存。

如果是这种情况,我会尝试以下操作:

更改ASP中的SPROC名称。. NET页面从custUPDATE到[custUPDATE],然后尝试运行它

最新更新