date >= '2004-6-30' and date < '2004-6-31' 不就可以了吗

解决方案 »

  1.   

    DateTime.Now.Year+"-"+DateTime.Now.Month +"-"+DateTime.Now.Day
    或DateTime.Now.Date
      

  2.   

    不好意思,6月没有31号,这样吧.
    "... where date >= '2004-6-30' and date < '" + Convert.ToDateTime("2004-6-31").AddDays(1).ToShortDateString() + "'..."
      

  3.   

    DateTime date1 = (DateTime)table.row[i]["date"]; //取出数据库中的时间
    通过DateTime.Now.Date取出日期后与date1.Date比较
      

  4.   

    yzh0523(水手) 多谢!搞定!
      

  5.   

    string condition = "where convert(nvarchar(10),CreateDate,101) = convert(nvarchar(10)," 
    + DateTime.Now.ToString() + ",101)";
      

  6.   

    用: DateTime.Parse("d") 转换成DateTime类型的年月日格式,再进行比较
      

  7.   

    string dt = System.DateTime.Now.ToString("yyyy-MM-dd");
    就可以得到关于年月日的字符串,然后用字符串比较就可以得到结果!