在使用得到DataSet ds=wfor.GetRowAll("",wheresql,""); DataTable dt=ds.Tables[0];忽略了ds为空的情况,检查了很多便居然出错在这里唉。以后应该注意判断是否结果为空的情况。