ist
Code: Select all
DataTable dataTable = null;
this._csvHeaders = null;
using (reader)
{
using (CsvReader csv = new CsvReader(reader, CultureInfo.InvariantCulture))
{
csv.Configuration.HasHeaderRecord = true;
csv.Configuration.MissingFieldFound = (field, index, context) => AddMissingFieldParseError(field, context.Row, index);
csv.Configuration.BadDataFound = (context) => AddBadDataFoundParseError(context.Field, context.Row);
using (CsvDataReader dataReader = new CsvDataReader(csv))
{
// Validate headers
this._csvHeaders = csv.Context.Reader.HeaderRecord.ToList();
TrimHeaderNames(ref _csvHeaders);
string errorMessage = string.Empty;
if (!ValidateHeaders(_csvHeaders, out errorMessage))
{
XOperationError operationError = new XOperationError("Duplicated error found", errorMessage);
this.ParseErrors.Clear();
this.ParseErrors.Add(0, new List { operationError });
return null;
}
dataTable = new DataTable();
dataTable.Load(dataReader);
}
}
}
Code: Select all
CsvConfiguration config = new CsvConfiguration(CultureInfo.InvariantCulture)
{
HasHeaderRecord = true,
MissingFieldFound = (field, index, context) => AddMissingFieldParseError(field, context.Row, index),
BadDataFound = (context) => AddBadDataFoundParseError(context.Field, context.Row)
};
< /code>
Jetzt beschwert es: < /p>
[list]
[*]MissingFieldFound
[*]
Code: Select all
BadDataFoundArgs
[/list]
Ich bin wirklich verwirrt. Sind diese nur Syntaxfehler?
Eine Hilfe wird geschätzt.