CommandBuilder的问题
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string Name=((TextBox)(this.GridView1.Rows[e.RowIndex].Cells[0].Controls[0])).Text.ToString();
string Address=((TextBox)(this.GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString();
string s = "select * from ts1";
SqlDataAdapter da = new SqlDataAdapter(s, conn);
SqlCommandBuilder qc = new SqlCommandBuilder(da);
DataSet ds = new DataSet();
da.Fill(ds, "a");
DataRow r=ds.Tables["a"].NewRow();
r["name"] = Name;
r["address"] = Address;
ds.Tables["a"].Rows.Add(r);
da.Update(ds,"a");
this.GridView1.EditIndex = -1;
this.show();
}
为什么不能更新 而是添加
谁能帮我该该