dataview findrows

DataView dvStu = dsStu.Tables[0].Copy().DefaultView;//当前学年学期下所有学生
dvStu.Sort = "bjmc,xm";

 

DataRowView[] drvXs = dvStu.FindRows(new object[]{bjmc,xm});
if (drvXs.Length == 0)
{
strError += "此学生在数据库中不存在!";
blError = false;
}
else if (drvXs.Length > 1)
{
strError += "此学生在数据库中存在重名!";
blError = false;
}
else {
xh = drvXs[0]["xh"].ToString();
for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
{
DataColumn dn=ds.Tables[0].Columns[j];
strContent += rs[dn.ColumnName.ToString()].ToString();
}
dtMatchResult.Rows.Add(new object[] { bh,xh,bjmc, xm, strContent });//向datatable中添加数据
intMatch++;
}

 

public string dr_fscj_err(DataTable dterr)
{
EasyUIDatagrid data = new EasyUIDatagrid();
data.total = dterr.Rows.Count;
data.rows = DataTableToobject(dterr);
return ToJson(data);
}

posted @ 2014-10-15 15:09  樱花飞落ll  阅读(823)  评论(0编辑  收藏  举报