postgresql - -Infinity added to database for NpgsqlParameter Timestamp field; expecting NULL -
i'm inserting record in postgressql table passing dbnull.value timestamp without time zone field using npgsqlparameter below:
ncmd.parameters.add(new npgsqlparameter(":enddate", npgsqldbtype.timestamp)); datetime? dtval = sr.getdatetime("enddate"); ncmd.parameters["enddate"].isnullable = true; if (dtval.hasvalue) ncmd.parameters["enddate"].value = dtval; else ncmd.parameters["enddate"].value = dbnull.value;
when try select records null values field use "select * "eval" "enddate" null" nothing returned. when read table data in pgadmin see value "-infinity" in field. please, tell me how pass null values npgsqlparameter?
thanks in advance,
danilo da silva
sorry, i've found error. when read data inserted datareader, getting default value datetime field when null , inserting default(datetime) not dbnull.value. i'm testing dtval.hasvalue && dtval != default(datetime) , goes right. thanks.
Comments
Post a Comment