查看SQL语句是否符合你所需要的,直接将得到的SQL语句在查询分析器中查询测试。

解决方案 »

  1.   

    if sbutton="1" then
        sqlt=" entry_id='"&dh&"'"
    end if改成:
    if sbutton="1" then
        sqlt=" and entry_id='"&dh&"'"
    end if
      

  2.   

    这个没有问题,放到查询分析器冲测试过。而且连起来是“select * from ok_tab where entry_id=***”,不需要加and.问题是第二个,sbutton=2 的时候 sql=sql+sqlt出来的语句,通不过。急呀~!
      

  3.   

    在sql="select * from ok_tab where"的where后加个空格
    sql=sql&sqlt改成sql=sql&" "&sqlt
      

  4.   

    sql="select * from ok_tab where 关键字段 not null"
    if sbutton="1" then
    sqlt=" entry_id='"&dh&"'"
    end if
    if sbutton="2" then
    sqlt=" ship_id ='"&chuan
    if hangci<>"" then
                  sqlt= sqlt&" and voyage_no ='"&hang&"'"
    end if
    end if
    session("sqlt")=sqlt
    sql=sql&sqlt
    response.Write(sql)
      

  5.   

    把sbutton=2时的SQL写出来的是什么???
      

  6.   

    这儿改成这样
    if sbutton="2" then
    sqlt=" ship_id ='"&chuan&"'"
      

  7.   

    sql="select * from ok_tab where" if sbutton="1" then
    sqlt=" entry_id='"&dh&"'"
    elseif sbutton="2" then
    sqlt=" ship_id ='"&chuan
    if hangci<>"" then
                                  sqlt= sqlt&" and voyage_no ='"&hang&"'"
    end if
    end ifsession("sqlt")=sqlt
    sql=sql&sqlt
    if Length(rtrim(sql))=26 then'如果sqlt=null,就将where去掉
        sql=left(sql,20)
    end if
    response.Write(sql)
      

  8.   

    sql="select * from ok_tab where" if sbutton="1" then
    sqlt=" entry_id=rtrim('"&dh&"')"
    end if
    if sbutton="2" then
    sqlt=" ship_id ='"&chuan
    if hangci<>"" then
                  sqlt= sqlt&" and voyage_no =rtrim('"&hang&"')"
    end if
    end ifsession("sqlt")=sqlt
    sql=sql&sqlt
    response.Write(sql)
      

  9.   

    sql="select * from ok_tab where" if sbutton="1" then
    sqlt=" entry_id=rtrim('"&dh&"')"
    end if
    if sbutton="2" then
    sqlt=" ship_id =rtrim('"&chuan&"')"
    if hangci<>"" then
                  sqlt= sqlt&" and voyage_no =rtrim('"&hang&"')"
    end if
    end ifsession("sqlt")=sqlt
    sql=sql&sqlt
    response.Write(sql)