You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I can get this sample code to print out the value of my custom column correctly, it does not work with SBC. SBC will not see my new column.
Working sample code:
`
using (StreamReader file = new StreamReader(_workingFile))
{
using (CsvReader csv = new CsvReader(file, true, '\t'))
{
csv.GetFieldHeaders();
csv.Columns.Add(new LumenWorks.Framework.IO.Csv.Column { Name = "Record_Date_UTC", Type = typeof(string) });
csv.UseColumnDefaults = true;
csv.Columns.Where(x => x.Name == "Record_Date_UTC").FirstOrDefault().DefaultValue = "Blah";
int fieldCount = csv.FieldCount;
fieldCount++; // Having to manually increase this by 1 to account for custom column
string[] headers = csv.GetFieldHeaders();
while (csv.ReadNextRecord())
{
for (int i = 0; i < fieldCount; i++)
Console.Write(string.Format("{0} = {1};",
headers[i], csv[i]));
Console.WriteLine();
}
}
}
SBC code throws "System.ArgumentException: 'Record_Date_UTC' field header not found.":
using (CsvReader csv = new CsvReader(file, true, '\t'))
{
csv.GetFieldHeaders();
csv.Columns.Add(new LumenWorks.Framework.IO.Csv.Column { Name = "Record_Date_UTC", Type = typeof(DateTime) , DefaultValue = fileDate.ToShortDateString() });
csv.UseColumnDefaults = true;
var fieldCound = csv.FieldCount;
}
`
The text was updated successfully, but these errors were encountered:
While I can get this sample code to print out the value of my custom column correctly, it does not work with SBC. SBC will not see my new column.
Working sample code:
`
using (StreamReader file = new StreamReader(_workingFile))
{
using (CsvReader csv = new CsvReader(file, true, '\t'))
{
csv.GetFieldHeaders();
SBC code throws "System.ArgumentException: 'Record_Date_UTC' field header not found.":
}
`
The text was updated successfully, but these errors were encountered: