Skip to content

Date parsing issue #203

@Shavrar

Description

@Shavrar

Hello, I observe that some dates are not being read by reader, while older dates are fine. It's probably the same problem as in PR
Fixed DbfValueDateTime null values checking #159.

You can easily reproduce it with attached dbf file. Last 3 rows won't have any dates but in fox pro I can see those dates.

My code for reading:

private DataTable Read(string path, string tableName)
{
    var options = new DbfDataReader.DbfDataReaderOptions
    {
        //SkipDeletedRecords = true                 
        // Encoding = EncodingProvider.GetEncoding(1252);
    };

    using var dbfDataReader = new DbfDataReader.DbfDataReader($"{path}\\{tableName}.db", options);
    var columns = dbfDataReader.GetColumnSchema();
    var datatable = new DataTable();
    foreach (var column in columns)
    {
        datatable.Columns.Add(column.ColumnName, column.DataType);
    }
    datatable.Columns.Add("Deleted", typeof(int));
    while (dbfDataReader.Read())
    {
        var values = new object[datatable.Columns.Count];
        for (var i = 0; i < columns.Count; i++)
        {
            values[i] = dbfDataReader.GetValue(i);
        }
        values[columns.Count] = dbfDataReader.DbfRecord.IsDeleted ? 1 : 0;
        datatable.LoadDataRow(values, true);
    }
    return datatable;
}

_PRM.zip

UPD:
image

Debuged mentioned date parsing, as you can see it's not empty date but first byte is 0. So it's exatcly the same issue in #159

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions