异常详细信息: System.IndexOutOfRangeException: 索引超出了数组界限。 50
publicstringallHouseList(){stringstr="SELECTY_geoname,Y_title,Y_pinyin,Y_abcFROMY_new...
public string allHouseList()
{
string str = "SELECT Y_geoname,Y_title,Y_pinyin,Y_abc FROM Y_newhouseview ORDER BY Y_abc ,Y_id DESC";
DataSet ds = Data.ExecuteDataSet(str);
System.Text.StringBuilder sb = new System.Text.StringBuilder("<h3 class=\"Allhouse_top\" id=\"A\"><b>A</b></h3><ul>");
string[] abc = { "A", "B", "C", "D", "E", "F", "G", "H","I", "J", "K", "L", "M", "N","O","P", "Q", "R", "S", "T","U","V", "W", "X", "Y", "Z" };
int count = ds.Tables[0].Rows.Count;
int m = 0;
int k = 0;
if (count > 0)
{
for (int i = k; i < abc.Length; i++)
{
for (int j = m; j < count; j++)
{
if (ds.Tables[0].Rows[j][3].ToString() != abc[j])
{
sb.AppendFormat("</ul><h3 class=\"Allhouse_top\" id=\"{0}\"><b>{1}</b></h3><ul>", ds.Tables[0].Rows[j][3].ToString(), ds.Tables[0].Rows[j][3].ToString());
}
m++;
i = abc.Length - Char.Parse(ds.Tables[0].Rows[j][3].ToString());
sb.AppendFormat("<li><span>[{0}]</span><a href=\"../{1}/index.html\">{2}</a></li>", ds.Tables[0].Rows[j][0].ToString(), ds.Tables[0].Rows[j][2].ToString(), ds.Tables[0].Rows[j][1].ToString());
}
}
sb.Append("</ul>");
}
return sb.ToString();
}
}
} 展开
{
string str = "SELECT Y_geoname,Y_title,Y_pinyin,Y_abc FROM Y_newhouseview ORDER BY Y_abc ,Y_id DESC";
DataSet ds = Data.ExecuteDataSet(str);
System.Text.StringBuilder sb = new System.Text.StringBuilder("<h3 class=\"Allhouse_top\" id=\"A\"><b>A</b></h3><ul>");
string[] abc = { "A", "B", "C", "D", "E", "F", "G", "H","I", "J", "K", "L", "M", "N","O","P", "Q", "R", "S", "T","U","V", "W", "X", "Y", "Z" };
int count = ds.Tables[0].Rows.Count;
int m = 0;
int k = 0;
if (count > 0)
{
for (int i = k; i < abc.Length; i++)
{
for (int j = m; j < count; j++)
{
if (ds.Tables[0].Rows[j][3].ToString() != abc[j])
{
sb.AppendFormat("</ul><h3 class=\"Allhouse_top\" id=\"{0}\"><b>{1}</b></h3><ul>", ds.Tables[0].Rows[j][3].ToString(), ds.Tables[0].Rows[j][3].ToString());
}
m++;
i = abc.Length - Char.Parse(ds.Tables[0].Rows[j][3].ToString());
sb.AppendFormat("<li><span>[{0}]</span><a href=\"../{1}/index.html\">{2}</a></li>", ds.Tables[0].Rows[j][0].ToString(), ds.Tables[0].Rows[j][2].ToString(), ds.Tables[0].Rows[j][1].ToString());
}
}
sb.Append("</ul>");
}
return sb.ToString();
}
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询