动态更新记录时出错. ? [英] Error while updating records in dynamic. ?

查看:67
本文介绍了动态更新记录时出错. ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

他在我的页面中使用了动态功能.更新记录时出现了
之类的错误 "

hi am using dynamic in my page .while updating record am getting error like
"

startIndex cannot be less than zero
parameter name :startIndex

"
在这行

"
in this line

fieldNames.Remove(fieldNames.Length - 1, 1);


可以给我发送任何一种错误类型的错误以及如何解决此问题..
谢谢


can any one tel me wat type of error and how to solve this..
thanks

推荐答案

hi,

您的代码将不起作用,因为fieldNames变量的长度等于零.

试试下面的代码

hi ,

your code will not work because fieldNames variable length equal to zero.

Try below code

if(fieldNames.Length > 0)
{
fieldNames.Remove(fieldNames.Length - 1, 1);
}



希望对您有帮助!



hop it will help!!


startIndex不能小于零
fieldNames.Remove(fieldNames.Length-1,1);

这些仅表示您的fieldNames.Length在某些情况下为零,因此是错误的.

请参阅fieldNames中的计数.使用VS DEBUGGER进行检查.它看起来像是空的,因此计数/长度为零,因此当您尝试从(0-1 = -1)索引中删除时,会发生错误.
startIndex cannot be less than zero
fieldNames.Remove(fieldNames.Length - 1, 1);

These simply means that your fieldNames.Length was zero at some instance and hence an error.

See the counts in the fieldNames. Use VS DEBUGGER and check. It looks like empty, hence zero count/length and so when you tried to remove from (0-1 = -1) index, error occurred.


很明显,fieldNames的长度为零.因此,Remove命令将引发错误.
Obviously the length of fieldNames is zero. Thus the Remove command throws an error.


这篇关于动态更新记录时出错. ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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