private bool FillDataTable(DataTable fileDt, InfoParts fullPartsList, int serverId) { int lastPart = -1; int partBase = -1; // each section will reset part number, this will help correct that between sections DataRow myRow = null; // foreach (InfoPart part in fullPartsList.PartsList) foreach (var section in fullPartsList.Parts) { partBase++; // bump part number if (lastPart > -1) { partBase += lastPart; // move up by atleast as many parts as in last section } var instancePath = section.Key; var instance = instancePath.Instance; var instanceId = Instances.ID(instance); var path = instancePath.Path; var pathId = Paths.ID(path); foreach (InfoPart part in section.Value) //fullPartsList.) { var partID = part.Identity; // Name column var partIndex = part.Index; // part - different numbers in case of collision of name var partName = part.Name; // column name var partType = part.Type; // column type var partValue = part.Value; // column value if (partIndex == lastPart) { // not new row } else { fileDt.MaybeAddRow(myRow); // new row myRow = fileDt.NewRow(); myRow.BeginEdit(); myRow["id"] = partIndex + partBase; // hope this is it... keep this!!! myRow["ServerId"] = serverId; myRow["InstanceId"] = instanceId; myRow["PathId"] = pathId; myRow["Name"] = partID; lastPart = partIndex; }; //throw new NotImplementedException("??? can we fix it path and instance"); var rowCol = myRow[partName]; var type = rowCol?.GetType(); object foo; if (partType.StartsWith("UInt")) { // may have to fix this to Int foo = GetStringIntforUInt(partType, partValue); } else { foo = partValue.Left(SQLHandler.MaxStringLength); } myRow[partName] = foo; } // save previous row fileDt.MaybeAddRow(myRow); //if (myRow != null) //{ // myRow.EndEdit(); // fileDt.Rows.Add(myRow); //} } return(true); }