上面的做法好像没有问题。
    在ResultSet rs=db.executeQuery(sql);之前打印SQl语句,在查询分析器里面直接执行SQL,看看是不是有执行结果,然后就可以确定错误的地方了。

解决方案 »

  1.   

    非溃感谢tangzhongp 朋友!帮我了一个大忙!
    THANKS!
      

  2.   

    if(dt1!=null)
           sql+=" and carry_m.dt=to_date('"+dt1+"','yyyy/mm/dd')";
    if(receive1!=null)
          sql+=" and receive='"+receive1+"'";
    改为
    if(!"".equals(dt1))
           sql+=" and carry_m.dt=to_date('"+dt1+"','yyyy/mm/dd')";
    if("".equals(receive1))
          sql+=" and receive='"+receive1+"'";
    这样可以检查变量是否为null,是否时空字符串。浏览器提交的form中对于没有填写的text,提交空字符串。getParameter可能返回空字符串(""). 
     
      

  3.   

    if(dt1!=null&&dt.equals("")==false)
             sql+=" and carry_m.dt=to_date('"+dt1+"','yyyy/mm/dd')";
      if(receive1!=null&&receive1.equals("")==false)
            sql+=" and receive='"+receive1+"'";