当前位置: 代码迷 >> ASP.NET >> ds.Tables[0].无值时,怎么判断
  详细解决方案

ds.Tables[0].无值时,怎么判断

热度:8244   发布时间:2013-02-25 00:00:00.0
ds.Tables[0].无值时,如何判断
我做一个查询,但是查询结果是变量,最小为1,最大为4,这样就有可能后面的无值,代码如下
C# code
 DataSet ds = new DataSet();        da.Fill(ds);        Label11.Text = ds.Tables[0].Rows[0].ItemArray[0].ToString();        Label12.Text = ds.Tables[0].Rows[1].ItemArray[0].ToString();        Label13.Text = ds.Tables[0].Rows[2].ItemArray[0].ToString();        Label14.Text = ds.Tables[0].Rows[3].ItemArray[0].ToString();

在这里我是做判断呢,还是?请教

------解决方案--------------------------------------------------------
for(int i=1;i<=ds.Tables[0].Rows.Count;i++)
{
Label lbl=this.FindControl("Label1"+i) as Label;
lbl.Text=ds.Tables[0].Rows[i][0].ToString(0;
}
  相关解决方案