Error when Saving into SQL Server
So here is the error...
An error occurred while saving the Panel. System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index at System.ThrowHelper.ThrowArgumentOutOfRangeException() at System.Collections.Generic.List`1.get_Item(Int32 index) at PanelController.Save(Int32 ID, FormCollection FormValues)
During debugging, I checked the parameter it was adding to the save stored proc, and the ID it was adding was 0. Then, when it used this
oDal.Execute("Lending.uspPanelSa开发者_高级运维ve")
Item.PanelId = oDal.Parameters("@PanelId").Value
To retrieve the ID to return it, it set it as 1000? Anyone know what the problem is?
Use SqlServer Profiler (in performance tools) to see what is realy send to SQL Server.
Sounds like it's not finding an output parameter called @PanelId in your command object. Was the parameter added and declared with the correct direction? Is the parameter declared properly in the stored procedure?
精彩评论