我必须将状态设置为接受,拒绝客户,同时在待处理时注册状态。我需要,如果有条件,选择哪一行,那么corressponding事件应该在数据库中更改为接受或拒绝。
protected void Button2_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("select * from Testing", OIMS_01);
SqlDataAdapter ad = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
ad.Fill(ds);
if (GridView1.SelectedRow != null)
{
ds.Tables(0).Rows(0).Item(0) = GridView1.SelectedRow.Cells(1).Text;
ds.Tables(0).Rows(0).Item(1) = GridView1.SelectedRow.Cells(2).Text;
ds.Tables(0).Rows(0).Item(2) = "Accept";
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please select a row.')", true);
}
ad.Update(ds);
}
答案 0 :(得分:2)
ds.Tables[0].Rows[0]["Your column name"] ="ACCEPT";
OR
ds.Tables[0].Rows[0][2] ="ACCEPT";