oracle 表字段FTIME是DATE类型,但是为空值,怎么取它的值啊?如下面的
if(ftime==null||ftime<dt)这句有问题
System.DateTime dt=Convert.ToDateTime(xxxxn_Part.Attributes["修改日期"].InnerText);
Sql="select ftime from dnc_productprogram where  fname= '"+Filename+"'";
ds=connect.GetRODS(Sql);
System.DateTime ftime=Convert.ToDateTime(ds.Tables[0].Rows[0][0]);
if(ftime==null||ftime<dt)

解决方案 »

  1.   

    ftime=Convert.ToDateTime(ds.Tables[0].Rows[0][0]);如果ds.Tables[0].Rows[0][0] 是空值,上面的转换会报错误的
    FTIME是DATE类型,那也不需要做Convert.ToDateTime
      

  2.   

    c#
    if (ds.Tables[0].Rows[0][0] != DBNull.Value)  //这种方式可以判断是否为null
    {   
    }
      

  3.   

    FTIME是DATE类型,那也不需要做Convert.ToDateTime--这句错了当ftime不为空时,可以做Convert.ToDateTime