作业帮 > 综合 > 作业

ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 1

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/04/29 19:11:17
ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 1

public MLimitUser GetModel(string strWhere) {
DataSet ds = GetList(strWhere);
//if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 1)
if (ds.Tables.Count > 0 )
{
//ds.Tables.Count =1;
string t=ds.Tables[0].Rows[0][0].ToString();//这里却 报错在位置 0 处没有任何行
//return DataRowToModel(ds.Tables[0].Rows[0]);
}
return null;
}
ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 1
估计是你的Tables[0]中没有值,你单步调试下,看看Tables[0]中有没有值