长度不能小于 0。
参数名: length说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.ArgumentOutOfRangeException: 长度不能小于 0。
参数名: length源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。堆栈跟踪: 麻烦各位给看一下,谢谢
[ArgumentOutOfRangeException: 长度不能小于 0。
参数名: length]
System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +7495991
System.String.Substring(Int32 startIndex, Int32 length) +11
Maticsoft.Web.inc.top.Bind() in D:\work\ThreelayerSolution\Web\inc\top.ascx.cs:39
Maticsoft.Web.inc.top.Page_Load(Object sender, EventArgs e) in D:\work\ThreelayerSolution\Web\inc\top.ascx.cs:22
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
参数名: length说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.ArgumentOutOfRangeException: 长度不能小于 0。
参数名: length源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。堆栈跟踪: 麻烦各位给看一下,谢谢
[ArgumentOutOfRangeException: 长度不能小于 0。
参数名: length]
System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +7495991
System.String.Substring(Int32 startIndex, Int32 length) +11
Maticsoft.Web.inc.top.Bind() in D:\work\ThreelayerSolution\Web\inc\top.ascx.cs:39
Maticsoft.Web.inc.top.Page_Load(Object sender, EventArgs e) in D:\work\ThreelayerSolution\Web\inc\top.ascx.cs:22
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
解决方案 »
- c#打开excel出现的问题,哪位大侠帮解决下?(下面是代码)
- 关于winfrom的一个问题,很急
- VS自带的MDF数据库在服务器上无法连接
- 你是c#高手就来
- 下载网页源码时,如何控制下载的时间超时5秒停止下载
- 不能将项目“jjj”中的依赖项“office, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”复制到运行目录,因为它
- 怎样将一个字符串转换成unicode,并计算长度,谢谢!
- 十六进制数的字符串怎么转成整型
- 三层留言本架构的问题
- 我做了一个多线程下载程,可以有问题,关于内存,请大家帮忙
- 正则表达式
- wpf 的textbox控件中如何添加根号
if(length>0)
然后在执行啊
判断前再加个是否null
{
DataSet ds = new Maticsoft.BLL.Tab_GuangGao().GetList(8, " type='3'", " addTime desc");
String pics = null;
String links = null;
String texts = null; foreach (DataRow row in ds.Tables[0].Rows)
{
pics += row["address"] + "|";
links += row["link"] + "|";
texts += row["title"] + "|";
} if(pics.Length >= 1 && texts.Length>= 1 && links.Length>= 1)
{
img_hidden.Value = pics.Substring(0, pics.Length);
title_hidden.Value = texts.Substring(0, texts.Length);
link_hidden.Value = links.Substring(0, links.Length);
}
}
{
DataSet ds = new Maticsoft.BLL.Tab_GuangGao().GetList(8, " type='3'", " addTime desc");
String pics = null;
String links = null;
String texts = null; foreach (DataRow row in ds.Tables[0].Rows)
{
pics += row["address"] + "|";
links += row["link"] + "|";
texts += row["title"] + "|";
} if(pics.Length >= 1 && texts.Length>= 1 && links.Length>= 1)
{
img_hidden.Value = pics.Substring(0, pics.Length);
title_hidden.Value = texts.Substring(0, texts.Length);
link_hidden.Value = links.Substring(0, links.Length);
}
}
String pics = null;
String links = null;
String texts = null;这里定义改成String pics = "";
String links = "";
String texts = ""
再试试
{
DataSet ds = new Maticsoft.BLL.Tab_GuangGao().GetList(8, " type='3'", " addTime desc");
String pics = null;
String links = null;
String texts = null; foreach (DataRow row in ds.Tables[0].Rows)
{
pics += row["address"] + "|";
links += row["link"] + "|";
texts += row["title"] + "|";
} if(pics.Length >= 1 && texts.Length>= 1 && links.Length>= 1)
{
img_hidden.Value = pics.Substring(0, pics.Length);
title_hidden.Value = texts.Substring(0, texts.Length);
link_hidden.Value = links.Substring(0, links.Length);
}
}
String pics = null;
String links = null;
String texts = null;这里定义改成String pics = "";
String links = "";
String texts = ""
再试试改过来试了,还是不行,
{
DataSet ds = new Maticsoft.BLL.Tab_GuangGao().GetList(8, " type='3'", " addTime desc");
String pics = null;
String links = null;
String texts = null; foreach (DataRow row in ds.Tables[0].Rows)
{
pics += row["address"] + "|";
links += row["link"] + "|";
texts += row["title"] + "|";
} if(pics.Length >= 1 && texts.Length>= 1 && links.Length>= 1)
{
img_hidden.Value = pics.Substring(0, pics.Length);
title_hidden.Value = texts.Substring(0, texts.Length);
link_hidden.Value = links.Substring(0, links.Length);
}
}
String pics = null;
String links = null;
String texts = null;这里定义改成String pics = "";
String links = "";
String texts = ""
再试试改过来试了,还是不行,额, String pics = null; String 改成小写string
把你出错的代码贴出来 void Bind()
{
DataSet ds = new Maticsoft.BLL.Tab_GuangGao().GetList(8, " type='3'", " addTime desc");
String pics = null;
String links = null;
String texts = null; foreach (DataRow row in ds.Tables[0].Rows)
{
pics += row["address"] + "|";
links += row["link"] + "|";
texts += row["title"] + "|";
} if(pics.Length >= 1 && texts.Length>= 1 && links.Length>= 1)
{
img_hidden.Value = pics.Substring(0, pics.Length);
title_hidden.Value = texts.Substring(0, texts.Length);
link_hidden.Value = links.Substring(0, links.Length);
}
}
String pics = null;
String links = null;
String texts = null;这里定义改成String pics = "";
String links = "";
String texts = ""
再试试改过来试了,还是不行,额, String pics = null; String 改成小写string我发现删掉这个文件还是报一样的错,而且这个路径D:\work\ThreelayerSolution\Web\inc\top.ascx.cs也和服务器上面的路径不一致