datagridview 的数据源 是dataset ds
当鼠标选种datagridview 的某一行时,保存时,选种的一行数据不更新,其他数据能更新,为啥???
SqlCommandBuilder SCB = new SqlCommandBuilder(adapter);
ds.Tables[0].GetChanges();
adapter.Update(ds.Tables[0]);
ds.AcceptChanges();
当鼠标选种datagridview 的某一行时,保存时,选种的一行数据不更新,其他数据能更新,为啥???
SqlCommandBuilder SCB = new SqlCommandBuilder(adapter);
ds.Tables[0].GetChanges();
adapter.Update(ds.Tables[0]);
ds.AcceptChanges();
DataRow row = ds.Tables[0].NewRow();
row[0] = .....
row[1] = .....
row[2] = .....//待更新行每列的值
ds.Tables[0].Rows.Add(row);
sqlcon.Open();//打开数据库链接
SqlCommandBuilder SCB = new SqlCommandBuilder(adapter);
adapter.Update(ds);
sqlcon.Close();//关闭链接