bpipe wrote:It might be a bug In PgSqlParameter.
First the DbTipe.DateTimeOffset is converter to PgSqlType.TimeStampTZ which is correct.
Second I get the exception:
"Cannot convert parameter value of type 'System.DateTimeOffset' to PostgreSQL type 'PgSqlType.TimeStampTZ'."
We have reproduced the issue. We will investigate it and notify you about the results as soon as possible.
bpipe wrote:Devart driver PgSqlTimeStamp class uses incorrect string formatting.
I was able to make DateTimeOffset work using this format (ISO 8601)
DateTimeOffset.Now.ToString("yyyy-MM-dd HH:mm:sszz")
If you want to pass parameters as strings, you have to control them to have the right server format. The ToString method of both PgSqlTimeStamp and DateTimeOffset depends on the local settings and doesn't always match the valid formats for the server. To get the string in the format expected by the server, you have to use the ToString(string format) method overload. For example:
Code: Select all
ToString("yyyy-MM-dd HH24:MI:SS.USTZH:TZM BC") for timestamp with timezone
ToString("yyyy-MM-dd HH24:MI:SS.US BC") for timestamp without timezone
ToString("yyyy-MM-dd AD") for date