日期:2014-05-17  浏览次数:20863 次

asp有关搜索的问题
有没有人,有关于搜索的asp代码呀
根据多个关键字进行搜索并更新列表显示




------解决方案--------------------
http://www.mysuc.com/article/guanyu-ASP-fuhekexuanduotiaojianchaxun-SQL-chulidesilu.htm
------解决方案--------------------
VBScript code

    key1 = request("key1")
    key2 = request("key2")
    key3 = request("key3")
    key4 = request("key4")
    
    sql = "select * from table where 1 = 1"
    if key1 <> "" then
        sql = sql & " and key1 = '"&key1&"'"
    end if
    'key2雷同。。。
    sql = sql & " order by id desc"

------解决方案--------------------
更新列表是什么意思?
------解决方案--------------------
更新列表
VBScript code

rs.open sqlstr,conn,1,1
 response.write("<table  ><tr>")
for each x in rs.fields
   response.write("<td>"&x.name&"</td>")   
next

 response.write("</tr>")
 do until rs.eof
 response.write("<tr>")

 for each x in rs.fields
  response.write("<td>"&x.value&"</td>")  
  next
   response.write("</tr>")
   
rs.movenext
loop
 response.write("</table>")

------解决方案--------------------
VB code

  key1 = request("key1")
    key2 = request("key2")
    key3 = request("key3")
    key4 = request("key4")
    
    sql = "select * from table where 1 = 1"
    sql2 = "update table set "

    if key1 <> "" then
        sql = sql & " and key1 = '"&key1&"'"
        sql2 = sql2 & " key1 = '"&key1&"',"
    end if
    'key2雷同。。。

    sql = sql & " order by id desc"