public int Update(DataSet ds)
{
try
{
SqlConnection cnn = new SqlConnection("Connection string here");
SqlDataAdapter da = new SqlDataAdapter("Select command here", cnn);
SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(da);
cnn.Open();
da.Update(ds);
}
catch
{
return -1;
}
finally
{
if(cnn!=null && cnn.State == ConnectionState.Open){
cnn.Close();
}
}
return 1;
}
You can change parameter
DataSet
to
DataRow[]
if you already get modified rows