ASP+ACCESS查询含有“书”的数据(JS版)


测试用数据库文件test.mdb从这里下载,程序代码如下:
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<%@Language="JavaScript" %> 
<% 
var conn = Server.CreateObject("ADODB.Connection"); 
conn.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+Server.MapPath("test.mdb")); 
var key = '书';
var rs = conn.Execute("select * From www_1500km_com where title like '%"+key+"%' "); 
while(!rs.EOF){ 
  %><%=rs("id").Value%>,
  <%=rs("title").Value.replace(key,'<font color=red>'+key+'</font>')%><hr>
  <%
  rs.MoveNext(); 
} 
%> 

测试结果如下图: