views:

38

answers:

2

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.uspPanelSave")
Item.PanelId = oDal.Parameters("@PanelId").Value

To retrieve the ID to return it, it set it as 1000? Anyone know what the problem is?

A: 

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?

Cade Roux
Direction is declared as follows. It's in the stored proc last I checked.With oDal.Parameters With .AddWithValue("@PanelId", Item.PanelId) .Direction = ParameterDirection.InputOutput
Scott
+1  A: 

Use SqlServer Profiler (in performance tools) to see what is realy send to SQL Server.

Malcolm Frexner