JSP+SQL server2000时间段的查询
大家帮忙看下这个为什么查不出~~
String form=request.getParameter( "form ")+ "- "+request.getParameter( "f ")+ "- "+ "01 ";
String to=request.getParameter( "to ")+ "- "+request.getParameter( "t ")+ "- "+ "01 ";
rs=stmt.executeQuery( " select * from ProEvolve where convert(varchar(16),examtime,120) between ' "+form+ " ' and ' "+to+ " ' ");
[解决办法]
从你的SQL语句发现两个问题,你的examtime是字符串类型的?如果是的话,不可以这样判断的,如果是时间类型的字段那么可以用下面的这句判断,不需要格式化数据的
rs=stmt.executeQuery( " select * from ProEvolve where examtime between ' "+form+ " ' and ' "+to+ " ' ");
[解决办法]
在这里一时半会说不完,急用的话。请加QQ:272723996