Click here to Skip to main content
15,906,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index


What I have tried:

<pre lang="c#">var test1 = Convert.ToInt32(Session["SID"]);
//  int ist = EAdapter.Insert(Convert.ToInt32(Session["SID"]), txtclgname.Text, txtErlno.Text,                       
 int ist=EAdapter.Insert(Convert.ToInt32(Session[test1]), txtclgname.Text, txtErlno.Text,drpsem.SelectedItem.Text, drpEdu.SelectedItem.Text, drpBranch.SelectedItem.Text, drpPassyear.SelectedItem.Text, float.Parse(txtCGPA.Text), drpreqskill.SelectedItem.Text, txtExSkill.Text, resume);
Posted
Updated 12-Aug-17 2:27am

1 solution

We can't fix this for you - we don't have access to your system while it is running, and can't tell what should or should not be in the Session object. Either your item isn't in the Session, or it has a different name, but we can't tell that.

So, its going to be up to you.
Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.

Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900