您的位置:程序门 -> vb -> 数据库(包含打印,安装,报表)



用sql语句,like 模糊查找时间/日期类型


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


用sql语句,like 模糊查找时间/日期类型
发表于:2007-01-15 15:17:23 楼主
"select   *   from   报表   where     日期   like   'format(cdate(txtmonth)) '   "
我想在报表中搜索到txtmonth框中输入的日期实现按月查找或者按年查找,例如txtmonth框中2006年12月,但是上面的语句怎么没有办法显示啊?报表中日期的格式是2006-12-25
发表于:2007-01-15 15:19:441楼 得分:0
access:
"select   *   from   报表   where     日期   like   # "   &   format(cdate(txtmonth))   &   "#   "
---------------------------------------------
sql   server:
"select   *   from   报表   where     日期   like   ' "   &   format(cdate(txtmonth))   &   " '   "
发表于:2007-01-15 15:25:012楼 得分:0
select   *   from   报表   where     month(日期)   =month( 'format(cdate(txtmonth)) '   )     and     year(日期)   =year( 'format(cdate(txtmonth)) '   )   "
   
*****************************************************************************
欢迎使用csdn论坛阅读器   :   csdn   reader(附全部源代码)  
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
发表于:2007-01-15 16:38:133楼 得分:0
access:
"select   *   from   报表   where     日期   like   # "   &   format(cdate(txtmonth), "yyyy-mm-dd ")   &   "#   "
---------------------------------------------
sql   server:
"select   *   from   报表   where     日期   like   ' "   &   format(cdate(txtmonth). "yyyy-mm-dd ")   &   " '   "


快速检索

最新资讯
热门点击