HI all,
I have part of my code that looks like this:
foreach (DataRow dtrow in _dtStaging.Rows)
{
DataRow newDatReportRow = _ds.datReportData.NewRow();
newDatReportRow["ReportID"] = 1;
newDatReportRow["MeasureID"] = 5;
newDatReportRow["Value"] = dtrow["Value"];
newDatReportRow["ReportDay"] = 2;
newDatReportRow["ReportMonth"] = 1;
newDatReportRow["ReportYear"] = 2006;
newDatReportRow[2] = dtrow["Profit_Center"];
_ds.datReportData.Rows.Add(newDatReportRow);
ncount++;
}
THis then adds over 15000 rows to the datatables, whats the best way of
doing an update to the sql table.
If call update inside the foreach loop, it seems to take a while, if I do
it outside I get a keyviolation erro
Thanks
Robert
|