Can't convert infinite timestamp values to DateTime
See original GitHub issueI’m trying to read database table where few columns are of ‘timestamp without time zone’ Datatype. when trying to read is into dataset I’m getting ‘InvalidCastError’. Column value in database is in YYYY-MM-DD HH:MM:SS format.
query I’m running is
string sql = "SELECT * FROM simple_table";
NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, conn);
ds.Reset();
da.Fill(ds);
Environment NPGSQL version 3.0.5 Dotnet framework 4.5 Visual studio 2012 web xpress
I’ve seen similar issue reported before, but I can’t get a solution.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Can't convert infinite timestamp values to DateTime ...
I am doing a fetch on a User entity and it is returning 'Can't convert infinite timestamp values to DateTime' An exception of...
Read more >c# - Why does setting a nulalble DateTime to ...
The problem lies within your C# code. According to MSDN: The DateTime.MaxValue field represents the largest possible value of DateTime ...
Read more >Thread: Problems with infinity - Postgres Professional
I can't change the database content because several stored procedures are based on infinite timestamp values. Of course I understand that conversion ......
Read more >Date and Time Handling
PostgreSQL supports the special values -infinity and infinity for the timestamp and date types (see docs); these can be useful to represent a...
Read more >Can't convert infinite timestamp values to DateTime
I'm trying to read database table where few columns are of 'timestamp without time zone' Datatype. when trying to read is into dataset...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I ran the following code using:
The following was run in pgAdmin:
And then this was run in C#:
This code completed with no issues, no exception was thrown. @dhnnjy can you post a little more code that generates the exception for you? I admittedly do not use
DataSets orDataAdapters so perhaps I’m doing something wrong here.Close for age,
Convert Infinity DateTimeshould be the solution to this.