Example:
// Connect to the server
SqlConnection myConn = new SqlConnection("integrated security=SSPI;data
source=HServer;persist security info=False;initial catalog=Northwind");
myConn.Open();
// Get the data
SqlDataAdapter myDataAdapter = new SqlDataAdapter();
myDataAdapter.SelectCommand = new SqlCommand("SELECT * FROM Categories",
myConn);
DataSet ds = new DataSet();
myDataAdapter.Fill(ds, "Table1");
// Release the SqlAdapter
myDataAdapter.Dispose();
myDataAdapter = null;
// Create a new SqlAdapter to update the data
SqlDataAdapter myDataAdapter2 = new SqlDataAdapter();
myDataAdapter2.SelectCommand = new SqlCommand("SELECT * FROM Categories",
myConn);
SqlCommandBuilder cb = new SqlCommandBuilder(myDataAdapter2);
myDataAdapter2.Update(ds, "Table1");
// Cleanup
myConn.Close();
Italo