从代码上看貌似看不出来有什么问题,所以你应该看看你的sql语句,你先这么做:
if (sdr.Read())
{
if (Convert.ToInt32(GridView1.Rows[0]) != -1 && Convert.ToInt32(GridView1.Rows[0]) >= 0)
{
((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"]);
}
}
将这些内容暂时注释掉
换成:
if (sdr.Read())
{
response.write(sdr["UF_CARD_TITLE"].ToString())
……
……
}
将这些值都输出看看到底能不能取到值
if (sdr.Read())
{
if (Convert.ToInt32(GridView1.Rows[0]) != -1 && Convert.ToInt32(GridView1.Rows[0]) >= 0)
{
((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"]);
}
}
将这些内容暂时注释掉
换成:
if (sdr.Read())
{
response.write(sdr["UF_CARD_TITLE"].ToString())
……
……
}
将这些值都输出看看到底能不能取到值