日期:2014-05-18  浏览次数:20742 次

SQL的between and 语句的问题
SubDate 是nvarchar型的,
String RMY = new String(request.getParameter("RMY").getBytes("ISO8859-1"));
String RMM = new String(request.getParameter("RMM").getBytes("ISO8859-1"));
String RMY2 = new String(request.getParameter("RMY2").getBytes("ISO8859-1"));
String RMM2 = new String(request.getParameter("RMM2").getBytes("ISO8859-1"));
String Date1 =RMY+RMM+"01";
String Date2 =RMY2+RMM2+"31";

String strSQL="select * from InfoHt where SubDate between '"+Date1+"' and '"+Date2+"'";
可是这个sql语句不起作用,请指教!谢谢!

------解决方案--------------------
between '"+Date1+" ' and '"+Date2+" '"; 不是这样写的