🍉 Meet Flexmonster Pivot Table & Charts 2.9.Check out all hot features!
Get Free Trial

Invalid datetime data formatting in CSV data source connected to a PostgreSQL database with .NET

Answered
Alex asked on February 2, 2021

Hello,
There is an issue with CSV data source connected to a PostgreSQL database with .NET.

After upgrading the Npgsql package from 4.1.8 to 5.0.3 the data for datetime columns are returned in invalid format.
Before package upgrade the data was looking like this:
d+CreationTime,t+TimeSpent
2021-01-29T17:41:32Z,60
2021-02-02T12:12:19Z,2700
After upgrading the data formatting is broken
+CreationTime,+TimeSpent
“1/29/2021 5:41:32 PM”,”00:01:00″
“2/2/2021 12:12:19 PM”,”00:45:00″

Data retrieved from database with code:

// ....
using (IDataReader dataReader = await command.ExecuteReaderAsync())
{
using (Stream inputStream = Compressor.Compressor.CompressDb((DbDataReader)dataReader))
{
using (StreamReader streamReader = new StreamReader(inputStream))
{
return await streamReader.ReadToEndAsync();
}
}
}

How the issue can be solved?

Thanks for your help.

1 answer

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster February 3, 2021

Hello,
 
Thank you for reaching out to us.
 
We would like to explain that the Data Compressor does not affect the way the Npgsql driver returns the data from your database.
Flexmonster Data Compressor only receives this data and passes it to the client-side component in CSV format.
Therefore, we suggest either adjusting the Npgsql configuration so that it returns dates in the required format or downgrading back to the 4.1.8 version of the Npgsql driver.
 
We hope it helps.
Please contact us in case other questions arise.
 
Regards,
Illia

Please login or Register to Submit Answer