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

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -