Shalex wrote:Try setting your FechaDec property to null in this way:
FechaDec = PgSqlTimeStamp.Null;
Is that what you mean?
I am still in problems with null dates. I followed your suggestion but I get an exception at the time of inserting the record to the table.
I first detect if the date control in my web form is null. If it is then I assing the value PgSqlTimestamp.Null to the property that represents such a control, otherwise I assign the date normally.
After this, I build the query string that will insert the record where the date field is enclosed within single quotes whether it is null or not.
Finally, I perform the insert operation and I get the exception message shown below.
invalid input syntax for type date: ""
PgSqlException
at Devart.Data.PostgreSql.PgSqlDataReader.e(Int32 A_0)
at Devart.Data.PostgreSql.PgSqlCommand.a(CommandBehavior A_0, IDisposable A_1, Int32 A_2, Int32 A_3)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader()
at Devart.Common.DbCommandBase.ExecuteNonQuery()
at Artista.Inserta(String& strTipoMensaje, Int16& intTotalMensajes, String[,] arrMensajes, String strOrigen)
I also made a test detecting if the field was null at the time of building the query string and, if it was, I did not include single quotes but I also got an exception. It says *** at or near ")" *** which is precisely where the date field goes.
syntax error at or near ")" at character 269
PgSqlException
at Devart.Data.PostgreSql.PgSqlDataReader.e(Int32 A_0)
at Devart.Data.PostgreSql.PgSqlCommand.a(CommandBehavior A_0, IDisposable A_1, Int32 A_2, Int32 A_3)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader()
at Devart.Common.DbCommandBase.ExecuteNonQuery()
at Artista.Inserta(String& strTipoMensaje, Int16& intTotalMensajes, String[,] arrMensajes, String strOrigen)
Everything works pretty fine when there is no null date value.
Thanks in advance for your advice.