当前位置: 代码迷 >> Java Web开发 >> SQL的between and 语句的有关问题
  详细解决方案

SQL的between and 语句的有关问题

热度:27   发布时间:2016-04-17 12:46:15.0
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+" '"; 不是这样写的
  相关解决方案