当前位置:主页>销售管理软件> 列表

select空值错误 找医药进销存

财务软件版1楼: table中日期字段有空值
selsql="select * from table where 日期字段<=#"+date1+"# and 日期字段<=#"+date2+"#"
提示null错误,请问如何对此access数据库筛选?

2楼: 帮帮忙 如服装管理软件

3楼: selsql="select * from table''+
'' where 日期字段 is not null and ''+
'' 日期字段<=#"+date1+"# and 日期字段<=#"+date2+"#";

试试看

4楼: WHERE (((日期字段)>=#10/10/2005# Or (日期字段)<=#10/10/2006#))
這樣就正確了。

支持交流QQ:136293586

5楼: selsql=''select * from table where 日期字段>=#''+date1+''# and 日期字段<=#''+date2+''#'';
其中 data1,data2 必须是合格的日期字符串。

6楼: 楼主的条件就有问题~~~
两个都是小于~~

财务软件版7楼: not null

8楼: selsql="select * from table where 日期字段 IS NOT NULL and 日期字段<=#"+date1+"# and 日期字段<=#"+date2+"#"

试试看

9楼: selsql="select * from table where 1=1";
if date1<>null then
selsql=selsql+" and 日期字段<=#"+date1+"#";
if date2<>null then
selsql=selsql+" and 日期字段<=#"+date2+"#";

10楼: sql.Add(''select * from 进货表 where 进货日期 BETWEEN #''+Trim(Edit3.Text)+''# AND #''+Trim(Edit4.Text)+''#'')
正确通过,进货表中进货日期也有空的,那不是问题关键,注意date1,date2要为日期字符串格式,不能是DataTime格式。

11楼: 楼主肯定会写这个语句的.我猜测问题可能是1.data1,data2 不是合格的日期字符串 2.涉及到日期的查询 就算语句正确也有可能出现问题(以前我也出现过)

12楼: xx 如医药进销存

13楼: xx