首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

语句未结束?解决方法

2012-03-21 
语句未结束?我在程序中有个查询( 按和弦 ),语句为setrsserver.CreateObject( adodb.recordset )sqls

语句未结束?
我在程序中有个查询( "按和弦 "),语句为
      set   rs=server.CreateObject( "adodb.recordset ")
      sql=sql& "select   id,name,price1,pic,mark,jiage   from   product   where   1=1   "
      if   he <> " "   then  
        sql=sql& "and   he     like   ' "he " '   "  
      end   if
      sql=sql& "   order   by   adddate   desc   "
        Rs.Open(sql),conn,1,1
        he为读过来的查询值,表中 "和弦 "字段也为he,怎么程序一运行就说 "语句未结束 "
报错行为 "sql=sql& "and   he     like   ' "he " '   "  
        而我去掉判断条件,直接按表中he字段实际存在的值运行语句:
          set   rs=server.CreateObject( "adodb.recordset ")
      sql=sql& "select   id,name,price1,pic,mark,jiage   from   product   where   1=1   "
      'if   he <> " "   then  
        sql=sql& "and   he     like   ' "64和弦 " '   "  
    '   end   if
      sql=sql& "   order   by   adddate   desc   "
        Rs.Open(sql),conn,1,1
也是报语句未结束,请问原因???

[解决办法]
sql=sql & "and he like '% " & he & "% ' "

热点排行
Bad Request.