<%
Response.Charset="gb2312" 
response.expires=-1str=request.QueryString("str")
yy=""
   dim objconn,objrs,connstr
   set objconn = createobject("adodb.connection")
   connstr = "provider = microsoft.jet.oledb.4.0;data source="&server.mappath("wt.mdb") 
   objconn.open connstr
   sql ="select * from book where Name like '"&str&"%'"   
   set  rs =objconn.execute(sql)
   if not rs.eof then
   do while not rs.eof 
     yy= rs("Name")&""&"-"&yy
     rs.movenext 
   loop
   rs.close
   set rs=nothing
   end if
   response.write yy
%>

解决方案 »

  1.   


    <%
    Response.Charset="gb2312" 
    response.expires=-1str=request.QueryString("str")
    yy=""
       dim objconn,objrs,connstr
       set objconn = createobject("adodb.connection")
       connstr = "provider = microsoft.jet.oledb.4.0;data source="&server.mappath("wt.mdb") 
       objconn.open connstr
       sql ="select * from book where Name like '"&str&"%'"   
       set  rs =objconn.execute(sql)
     '''''''''''''''''''''''  if not rs.eof then
       do while not rs.eof 
         yy= rs("Name")&""&"-"&yy
         rs.movenext 
       loop
       rs.close
       set rs=nothing
    '''''''''''''''''''''''   end if
       response.write yy
    %>
      

  2.   

    不行噢
    好象不是因为循环没写对  ie下都是可以查询出来的
    家里的ff下都是好的
    公司这边就是坏的
      

  3.   

    试下<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
    <%
    Session.CodePage=936
    Response.Charset="gb2312" 
    response.expires=-1
    str=request.QueryString("str")
    %>
      

  4.   

    一定要在<%后的第一行就设置:
    Response.Charset="GB2312"
    如果有中文最好用Server.URLEncode这样:Request.QueryString取到的值才不至于引起乱码
      

  5.   

    to 4楼   好象好不行
    我是这么写的
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
    <%
    Response.Charset="gb2312"         '和下面的那行换了位置也不行
    Session.CodePage=936
    response.expires=-1
    str=request.QueryString("str")
    yy=""
       dim objconn,objrs,connstr
       set objconn = createobject("adodb.connection")
       connstr = "provider = microsoft.jet.oledb.4.0;data source="&server.mappath("wt.mdb") 
       objconn.open connstr
       sql ="select * from book where Name like '"&str&"%'"   
       set  rs =objconn.execute(sql)
       do while not rs.eof 
         yy= rs("Name")&""&"-"&yy
         rs.movenext 
       loop
       rs.close
       set rs=nothing
       response.write yy
    %>to 5楼
    没看懂你说的to 6 楼
    写上去了还是乱码了。。
      

  6.   

    str是哪里传过来的?把那个页面也加上
    <%
    Response.Charset="gb2312"
    ...................
    ...................
    %>
      

  7.   

    to  9楼
    +了额  还是乱码http://download.csdn.net/source/895964
    各位大虾帮忙调试下(ff下中文乱码)
      

  8.   

    原来是AJAX,你没说明白哦把 var str = "2.asp?str="+document.getElementById("sou").value
    换成: var str = "2.asp?str="+escape(document.getElementById("sou").value)应该就没问题了我没测试,只是看了看。你自己先搞搞吧