Actually this is an interesting topic, but I would advice using SqlBulkCopy instead, which provide amazing performance, with just a few lines of code:
public virtual bool SqlBulkCopy(DataSet ds, string TableName) // provide ability to update any Table in the DS, assume TableName is idem for SQL and App Level
bool result = true;
using (SqlBulkCopy BulkCopy = new SqlBulkCopy(MyConnectionString))
{
BulkCopy.DestinationTableName = TableName;
try
{
BulkCopy.WriteToServer(ds.Tables[TableName]); // Write from the source to the destination.
}
catch (Exception e)
{
// Provide feedback of error issues, to be recovered using something like "DataSetErrorsShower.Show()"
ds.Tables[TableName].Rows[0].RowError = ExceptionHandler.WrapSqlException(e);
result = false;
}
if (result == true)
ds.Tables[TableName].AcceptChanges();
return result
}
Hope it helps, keep on comments.
Kind Regards,
Louis.