private void _Update()
{
DataSet _DataSet = new DataSet();
string cmd = "Select * from table1";
SqlConnection _Connection = new SqlConnection("Data Source=;Integrated Security=SSPI;Initial Catalog=database");
SqlDataAdapter _Adapter = new SqlDataAdapter(cmd,_Connection);
SqlCommand _Update = new SqlCommand();
_Adapter.UpdateCommand = _Update;
_Adapter. = "Update table1 Set row1=@row;
_Adapter.UpdateCommand.Connection = _Connection;
_Adapter.UpdateCommand.Parameters.Add(new SqlParameters("@d"SqlDbStype.Char,10));
this.dataGrid.DataSource = _DataSet.Tables["table1"];
_Adapter.Update(_DataSet,"table1");
}
这是更新,使用插入对象就可以了!