DataSet2 ds = new DataSet2();
SqlDataAdapter da1 = new SqlDataAdapter(str, conn);
da1.Fill(ds, "table"); //已经装载到DataSet数据集中了
for (int k = 0; k < ds.Tables["table"].Rows.Count; k++)
{
for (int j = 0; j < ds.Tables["table"].Columns.Count; j++)
{
if (ds.Tables["table"].Rows[k]["emergency"].ToString().Trim() == "1")
{
ds.Tables["table"].Rows[k]["emergency"] = "合格";
}
else if (ds.Tables["table"].Rows[k]["emergency"].ToString().Trim() == "0")
{
//emergency = "处置";
ds.Tables["table"].Rows[k]["emergency"] = "处置";
}
}
}
ds.AcceptChanges();
转载于:https://blog.51cto.com/myitworld/530903