索引超出范围。必须为非负值并小于集合大小(超紧急,求救!!!)
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.ArgumentOutOfRangeException: 索引超出范围。必须为非负值并小于集合大小。
参数名: index
源错误:
行 33: if (sdr.Read())行 34: { 行 35: ((LinkButton)(GridView1.Rows[0].Cells[1].FindControl("LinkButton1"))).Text = sdr["UF_CARD_TITLE"].ToString();行 36: ((Label)(GridView1.Rows[0].Cells[2].FindControl("Label2"))).Text = Convert.ToString(sdr["UF_CARD_USERID"]);行 37: ((Label)(GridView1.Rows[0].Cells[2].FindControl("Label3"))).Text = Convert.ToString(sdr["UF_CARD_ADDTIME"]); |
源文件: e:\admin\bbs_liebiao.aspx.cs 行: 35
protected void binddingzhi()
{
string sqlcomm = "";
sqlcomm += "SELECT UF_CARD_TITLE,UF_CARD_USERID,UF_CARD_ADDTIME,UF_RECARD_SORT, ";
sqlcomm += " UF_CARD_VISITQUANTITY,UF_RECARD_ADDTIME,UF_RECARD_USERID FROM UF_CARD,UF_RECARD WHERE UF_RECARD_SORT IN ";
sqlcomm += " (SELECT count(*) FROM UF_RECARD WHERE UF_RECARD_CARDID IN (SELECT UF_CARD_ID FROM UF_CARD)) ";
sqlcomm += " AND UF_CARD_TOP = 1 ORDER BY UF_CARD_ADDTIME desc ";
SqlConnection myconn = new SqlConnection(publicclass.getconnstr());
myconn.Open();
SqlCommand mycommand = new SqlCommand(sqlcomm, myconn);
SqlDataReader sdr = mycommand.ExecuteReader();
if (sdr.Read())
{
((LinkButton)(GridView1.Rows[0].Cells[1].FindControl("LinkButton1"))).Text = sdr["UF_CARD_TITLE"].ToString();
((Label)(GridView1.Rows[0].Cells[2].FindControl("Label2"))).Text = Convert.ToString(sdr["UF_CARD_USERID"]);
((Label)(GridView1.Rows[0].Cells[2].FindControl("Label3"))).Text = Convert.ToString(sdr["UF_CARD_ADDTIME"]);
((Label)(GridView1.Rows[0].Cells[3].FindControl("Label4"))).Text = Convert.ToString(sdr["UF_RECARD_SORT"]);
((Label)(GridView1.Rows[0].Cells[3].FindControl("Label5"))).Text = Convert.ToString(sdr["UF_CARD_VISITQUANTITY"]);
((Label)(GridView1.Rows[0].Cells[4].FindControl("Label6"))).Text = Convert.ToString(sdr["UF_RECARD_USERID"]);
((Label)(GridView1.Rows[0].Cells[4].FindControl("Label7"))).Text = Convert.ToString(sdr["UF_RECARD_ADDTIME"]);
}
}