Scott
Scott

Reputation: 4210

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.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?

Upvotes: 0

Views: 108

Answers (2)

Mathias F
Mathias F

Reputation: 15911

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

Upvotes: 1

Cade Roux
Cade Roux

Reputation: 89711

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?

Upvotes: 0

Related Questions