⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 search.asp

📁 wap2.0开发实例。很好的学习材料!!!!!!!!!!!!!!!!!!!11
💻 ASP
字号:
<%
Response.ContentType ="application/vnd.wap.xhtml+xml"
%>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Cache-Control" content="max-age=0"/>
<meta http-equiv="Cache-control" content="no-cache" />
</head>
<body> 
<p> 
<%
Set Conn=Server.CreateObject("Adodb.Connection")
DBPath = Server.MapPath("#WapZJ.mdb") 
Conn.Open "Driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
'接收中文字符。
Dim KeyWord
KeyWord=Request("KeyWord")
Dim SQL,Rs
'注意下边的这句sql语句。有时候变量要用'引起来。
SQL = "SELECT * FROM WAPZJ WHERE Title Like '%" & KeyWord & "%'" &" Or Content Like '%" & KeyWord & "%'"
Set Rs = Server.CreateObject("ADODB.RecordSet")
Rs.Open SQL,Conn,1,3
If Rs.EOF then 
'对于使用Response.Write输出的语句好像必须要进行UTF-8转码,虽然声明了使用gb2312。
Response.Write Uni("没有结果")
Response.Write "<do type='accept' label='Retry'>" 
Response.Write " <go href='index.asp'/>" 
Response.Write "</do>" 
Else 
Response.Write "标题:" & Uni(Rs("Title")) & "<br/>" 
Response.Write "内容:" & Uni(Rs("Content"))
End If
%>
<br/>
<a title="确定" href="index.asp">重新搜索</a>
</p>
</body>
</html>
<%
Rs.Close
Set Rs=Nothing
Conn.Close
Set Conn = Nothing
%>
<%
'以下是UTF-8转码的函数
Function Uni(Chinese) 
For I = 1 to Len (Chinese) 
A=Mid(Chinese, i, 1) 
Uni=uni & "&#x" & Hex(Ascw(a)) & ";" 
Next 
End Function 
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -