我在sql server上创建了一个用于更新记录的存储过程,而当我插入所需的参数时,它可以正常工作.但是当涉及到ASP .NET时,当我在ASPX GridView上按update时运行应用程序时,它会给我一个消息“过程或函数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我做错什么了?请帮帮忙
发布于 2014-05-20 16:03:27
错误是非常清楚的:您向该方法传递的参数比它所期望的要多,这将导致错误。仔细检查在对SP的调用中要传递多少参数。
发布于 2014-05-20 16:21:33
我偶尔注意到,即使在Server上做了更改之后,ASP.NET也会在Visual中缓存旧的SPROC。因此,例如,您通过添加一个参数来更改custUPDATE,并将该参数添加到您的ASP.NET代码中,但由于旧的SPROC正在被缓存,因此仍然收到“指定的太多论述器”错误。
如果是这样的话,我会尝试以下几点:
将ASP.NET页面中的SPROC名称从custUPDATE更改为custUPDATE,然后尝试运行它。
https://stackoverflow.com/questions/23764748
复制相似问题