strsql.Format("select * from hx_sale where btid = %d and saletime >='#%s#' and saletime <= '#%s#'",n,str1,str2);
---------
或者
strsql.Format("select * from hx_sale where btid = %d and saletime >='%s' and saletime <= '%s'",n,str1,str2);
或者
strsql.Format("select * from hx_sale where btid = %d and saletime >=#%s# and saletime <= #%s#",n,str1,str2);

解决方案 »

  1.   

    strsql.Format("select * from hx_sale where btid = %d and saletime >=#%s# and saletime <= #%s#",n,str1,str2);
      

  2.   

    strsql.Format( "select   *   from   hx_sale   where   btid   =   %d   and   saletime   between #%s#   and   #%s# ",n,str1,str2);
      

  3.   

    用BETWEEN和AND来控制就可以了,省得哪样写.你传两个变量进去...不要用>=或<=效果一样的..
      

  4.   

    access是这样的,SQL SERVER似乎不行,我记得是这样的,好久不用了,记不清了。