Hi, I use the same method as ericg
There is one small piece of code missing in his code. There needs to be a row variable defined within the For loop:
DataRow row = importData.Rows[i];
Full code is:
// Check that the required columns exist.
if (!importData.Columns.Contains("Domain"))
importData.Columns.Add("Domain", typeof( System.String ));
// Iterate through all rows
for (int i = 0; i < importData.Rows.Count; i++)
{
DataRow row = importData.Rows[i];
// Set value MyDomain to each row in added column Domain
if (row["Domain"] == System.DBNull.Value)
{
row["Domain"] = " MyDomain";
}
}
return importData;