0

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?

1
  • 3
    i'm not convinced there is enough code to analyse this here, the error implies you have a generic list of int's somewhere that you are accessing by index using an int larger than the list size Commented Jul 16, 2010 at 18:35

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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?

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.