2014-05-20 75 views
0

我在sql server上創建了一個存儲過程來更新記錄,雖然在我插入所需的參數時它工作正常......但是當涉及到ASP .NET時,當我運行應用程序時新聞更新ASPX GridView它給了我一個消息 「過程或函數custUPDATE指定的參數太多。」存儲過程和ASP .NET

這裏是我的程序

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 [email protected]; 
select @rmn= orderVIEW.Remaining from orderVIEW where [email protected]; 
select @tt=orderVIEW.Total from orderVIEW where [email protected]; 
--select @amnt_paid= amnt_paid from inserted; 



if(@[email protected]) 
begin 
update [dbo].[eggsOrders] set [email protected]_id, [email protected], [email protected], [email protected], [email protected]_status, py_status='paid in full', [email protected]_date where [email protected]; 

end 

else if(@amnt_paid>0 and @[email protected]) 
begin 
update [dbo].[eggsOrders] set [email protected]_id, [email protected], [email protected], [email protected], [email protected]_status, py_status='In-Progress', [email protected]_date where [email protected] 

end 
else if(@amnt_paid=0 and @rmn [email protected]) 
begin 
update [dbo].[eggsOrders] set [email protected]_id, [email protected], [email protected], [email protected], [email protected]_status, py_status='Payment Pending', [email protected]_date where [email protected] 

end 


end 
go 

我在做什麼錯誤的代碼??? 請幫忙

回答

1

這個錯誤很清楚:你傳遞了更多的參數給方法比它所期望的,導致錯誤。仔細查看您在調用SP時傳遞了多少個參數。

0

我偶爾注意到,即使在SQL Server上進行更改後,ASP.NET也會在Visual Studio中緩存舊的SPROC。因此,例如,您通過添加參數來更改custUPDATE,並將該參數添加到您的ASP.NET代碼中,但仍舊收到「too many arguemtns specified」錯誤,因爲舊SPROC正在緩存。

如果這是我想嘗試下面的情況:

從custUPDATE你的ASP.NET頁面[custUPDATE]更改存儲過程的名稱,然後嘗試運行它。