Good catch! Thank you.
I ended up with this code.
using (SqlConnection cn = new SqlConnection(DBConnectionString))
{
using (SqlCommand updCmd = new SqlCommand
("sp_web_edit_manager_update", cn))
{
SqlDataAdapter adpt = new SqlDataAdapter(updCmd);
updCmd.CommandType = CommandType.StoredProcedure;
updCmd.CommandTimeout = Convert.ToInt32
(ConfigurationSettings.AppSettings["dbCommandTimeout"]);
updCmd.UpdatedRowSource = UpdateRowSource.None;
updCmd.Parameters.Add("@entity", SqlDbType.VarChar, 10,
dtOnlyChanges.Columns[0].ColumnName);
updCmd.Parameters.Add("@edit_id", SqlDbType.Int, 4,
dtOnlyChanges.Columns[1].ColumnName);
updCmd.Parameters.Add("@edit_override", SqlDbType.VarChar,
1, dtOnlyChanges.Columns[2].ToString());
updCmd.Parameters.Add("@biller_cd", SqlDbType.VarChar, 20,
dtOnlyChanges.Columns[3].ToString());
updCmd.Parameters.Add("@include_in_stats", SqlDbType.
VarChar, 1, dtOnlyChanges.Columns[4].ToString());
adpt.UpdateCommand = updCmd;
// Set the Batch Size. 0 means all; default is 1.
adpt.UpdateBatchSize = 0;
foreach(DataRow b in dtOnlyChanges.Rows)
{
b.SetModified();
}
cn.Open();
// send the changed rows("modified") to the database
adpt.Update(dtOnlyChanges);
}
}
--
Message posted via
http://www.dotnetmonster.com