将gridview默认值1900-01-01更改为null或""

时间:2015-01-04 11:07:46

标签: asp.net datetime gridview null

我正在使用此查询将空值插入日期时间字段:

echCommand="INSERT INTO GPEC_TBL_ECHEANCE(echeance, echeance_debut, echeance_fin, objectif_id) 
VALUES (null, " + System.DBNull.Value + "," + System.DBNull.Value + "," + newObjectifId + ")";

var echCommand = new SqlCommand(insertEchQuery, con);

但是当显示GridView时,我仍然得到日期1900-01-01

在Gridview中,我应该添加或修改哪些空白字段而不是这个丑陋的日期?

1 个答案:

答案 0 :(得分:0)

它正好是您正在查找的错误位置,在gridview中显示它时,检查它是否返回dbnull值