String mon=new String();
mon = request.getParameter("mon");
int tmpmon = 0;
try
{
    tmpmon = Integer.parseInt(mon);
}
catch(Exception e)
{
...
}String SQL = ......

解决方案 »

  1.   

    to : acefr():
    谢谢,
    我按照上面的做了,可是还是不行。
    看看我写的sql没有问题吧?
    再次感谢!
      

  2.   

    sql="部分语句"+字符串变量+"部分语句";不要不变量引起来
      

  3.   

    String mon=new String();
    mon=request.getParameter("mon");
    SQL="select * from monthreport1 where m_date2-m_date1>=28 and month(m_date1)=" +  mon + " and month(m_date2)=" + mon;
      

  4.   

    mon=request.getParameter("mon");
    int mon_i = Integer.parseInt(mon);
    SQL="select * from monthreport1 where m_date2-m_date1>=28 and month(m_date1)=mon_i  and month(m_date2)= mon_i ";
      

  5.   

    着急了,写错了
    mon=request.getParameter("mon");
    int mon_i = Integer.parseInt(mon);
    SQL="select * from monthreport1 where m_date2-m_date1>=28 and month(m_date1)="+mon_i+"  and month(m_date2)="+mon_i;