SqlCommand cmd=new SqlCommand("select count(*) from personnel where IDNO='"+tID.Text.ToString()+"'",con);
int count=Convert.ToInt32(cmd.ExecuteScalar());
if(count>0)
{
Session["sfz"]=tID.Text;
Page.Response.Redirect("main.aspx");
}
else
{
this.dd.Text="输入身份证号码尚未投保";
}
我已经是查到personnel 表中有了IDNO='"+tID.Text.ToString()+"这个内容才跳转到"main.aspx"的,
可是当跳到main.aspx页面时,却出现错误:::异常详细信息: System.IndexOutOfRangeException: 在位置 0 处没有任何行。this.dept.Text=dcdept.Tables["Monthly"].Rows[0][0].ToString();
怎么办???main.aspx页面的代码是:
SqlDataAdapter sdadept=new SqlDataAdapter("select top 1 Dept.DeptName from Monthly inner join Dept on Dept.DeptID=Monthly.DeptID where Monthly.IDNO='"+er+"'order by Monthly.Monthly desc", con);DataSet dcdept= new DataSet();
sdadept.Fill(dcdept,"Monthly"); 

this.dept.Text=dcdept.Tables["Monthly"].Rows[0][0].ToString();