请帮我解决这个问题...我收到错误,因为“位置 0 没有行”,“用户代码未处理索引超出范围异常”
下面是我的代码
protected void Page_Load(object sender, EventArgs e)
{
MTMSService obj = new MTMSService();
DBAccess db = new DBAccess();
{
MTMSDTO objc = new MTMSDTO();
{
objc.TaskID = Convert.ToInt32(Session["TaskID"]);
DataSet rep = obj.GetReports(objc);
DataView Rprts = new DataView();
Rprts.Table = rep.Tables[0];
LblTaskID.Text = rep.Tables[0].Rows[0]["TaskID"].ToString();
LblTaskName.Text = rep.Tables[1].Rows[0]["TaskName"].ToString();
LblDueDate.Text = rep.Tables[2].Rows[0]["DueDate"].ToString();
LblDescription.Text = rep.Tables[3].Rows[0]["Description"].ToString();
LblAssignBy.Text = rep.Tables[4].Rows[0]["AssignBy"].ToString();
LblStatus.Text = rep.Tables[5].Rows[0]["Status"].ToString();
LblPercentageComplete.Text =
rep.Tables[6].Rows[0]["PercentageComplete"].ToString();
LblTaskName.Visible = true;
LblAssignBy.Visible = true;
LblDescription.Visible = true;
LblDueDate.Visible = true;
LblStatus.Visible = true;
LblPercentageComplete.Visible = true;
LblAssignTo.Visible = false;
}
}
}