异常详细信息:system.argumentoutofrangeexception:index超出范围。必须是非负数且小于集合的大小。参数名称:index [英] Exception details: system.argumentoutofrangeexception: index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

查看:131
本文介绍了异常详细信息:system.argumentoutofrangeexception:index超出范围。必须是非负数且小于集合的大小。参数名称:index的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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);

推荐答案

我们无法为您解决此问题 - 我们无法访问您的系统当它正在运行时,并且无法分辨Session对象中应该或不应该是什么。您的项目不在会话中,或者它有不同的名称,但我们无法分辨。



所以,它取决于你。

在函数的第一行放置断点,然后通过调试器运行代码。然后查看您的代码,并查看您的数据并找出手动应该发生的事情。然后单步检查每一行你期望发生的事情正是这样做的。如果不是,那就是当你遇到问题时,你可以回溯(或者再次运行并仔细观察)以找出原因。


对不起,但我们不能为你做到这一点 - 时间让你学习一门新的(非常非常有用的)技能:调试!
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!


这篇关于异常详细信息:system.argumentoutofrangeexception:index超出范围。必须是非负数且小于集合的大小。参数名称:index的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆