public static SPDataRecord ToSPDataRecord(this DBFieldCollection fieldData, SPColumnMappings mapping, string keyValue) { var dataRecordOut = new SPDataRecord(keyValue); foreach (SPColumnMapping item in mapping) { var spfield = new SPDataField(); spfield.SPColumnInternalName = item.SharePointDestinationField; spfield.SPDataType = item.SharePointDataType; try { spfield.SPValue = fieldData[item.DBSourceField].ToString(); } catch { spfield.SPValue = string.Empty; } dataRecordOut.Add(spfield); } return dataRecordOut; }
public static SPDataRecord ToSPDataRecord(this DBFieldCollection fieldData, SPColumnMappings mapping, string keyValue) { var dataRecordOut = new SPDataRecord(keyValue); foreach (SPColumnMapping item in mapping) { var spfield = new SPDataField(); spfield.SPColumnInternalName = item.SharePointDestinationField; spfield.SPDataType = item.SharePointDataType; try { spfield.SPValue = fieldData[item.DBSourceField].ToString(); } catch { spfield.SPValue = string.Empty; } dataRecordOut.Add(spfield); } return(dataRecordOut); }