The simplest option is to use a table adapter as described in the link below. This however is not necessarily the quickest way to update the data.
The other option is to loop round each DataRow in the DataTable on the DataSet, and create a sql string with an UPDATE statement, as shown below.
System.Data.SqlClient.SqlConnection sqlConnection1 =
new System.Data.SqlClient.SqlConnection(“YOUR CONNECTION STRING”);
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
cmd.set_CommandType(System.Data.CommandType.Text);
cmd.set_CommandText(“UPDATE Region SET RegionID = 1, RegionDescription = ‘East’ WHERE RegionID = 1″);
cmd.set_Connection(sqlConnection1);
Comments
Leave a comment Trackback