象形字有哪些图片大全:帮偶看看搜索数据代码

来源:百度文库 编辑:中科新闻网 时间:2024/05/02 09:53:48
<!--#include file="../news/conn.asp"-->
<%
word=request("word")
columns=request("columns")
if word="" then
response.write "<script>alert('查找字符串不能为空!');history.back();</Script>"
response.end
end if
%>
<%
function chkhtm(stra)
stra=replace(stra,"<","<")
stra=replace(stra,">",">")
stra=replace(stra,"'","")
stra=replace(stra,"(","(")
stra=replace(stra,")",")")
stra=replace(stra,";",";")
stra=replace(stra,",",",")
stra=replace(stra,"%","%")
stra=replace(stra,"+","+")
chkhtm=stra
end function
function titleb(str,strlen)
dim l,t,c, i
l=len(str)
t=0
for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t+2
else
t=t+1
end if
if t>=strlen then
titleb=left(str,i)&"…"
exit for
else
titleb=str&""
end if
next
end function
columns=request("columns")
if columns="按内容" then
columns="content"
elseif columns="按标题" then
columns="title"
else
columns="addtime"
end if
on error resume next
word=chkhtm(trim(Request("word")))
nnn="<font color='#FF0000'><span style='background-color: #FFFF00'>"&word&"</span></font>"
set rs1=server.CreateObject ("adodb.recordset")
rs1.Open "select distinct(type1) from news where type1='"&rs("type1")&"'",conn,0,1
if word="" then
sql = "select * from news where 1=2 order by id desc"
elseif columns="title" or columns="content" then
sql = "select * from news where title like '%"&word&"%' order by id desc"
elseif len(word)=4 then
sql= "select * from news where addtime >#" & word & "-1-1# and addtime<#" & word+1 & "-1-1#" & " order by id desc"
else
sql= "select * from news where addtime >#" & word & "-1# and addtime<(#" & word & "-1#+30)" & " order by id desc"
end if
rs1.open sql,conn,1,1
if rs1.eof and rs1.bof then
response.write "<p align='center'>请输入正确的表达式 年-月</p>"
i=0
do while not rs1.eof
end if
rs1.close
set rs1=nothing
%>
<!--#include file = admin_conn.asp -->
<%
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "select distinct(type) from [config]",conn,0,1
if rs.recordcount<>0 then
sotop=rs("sotop")
sobottom=rs("sobottom")
end if
rs.close
set rs=nothing
Response.Write sotop
%>

-------------
还缺一段代码!附到下面

看看这个代码那不对?偶写的这个页是搜索两个数据库,addtime为时间,content为内容,title为标题.看看这个代码那不对?两个数据库里都有表news并且都有addtime,content,tietle这三个字段.但现在测试就是不能通过.帮偶改下偶
代码太长不让发!偶换个号在下面回答那发全部的代码!麻烦大家帮忙看下.

<!--#include file="../news/conn.asp"-->
<%
word=request("word")
columns=request("columns")
if word="" then
response.write "<script>alert('查找字符串不能为空!');history.back();</Script>"
response.end
end if
%>
<%
function chkhtm(stra)
stra=replace(stra,"<","<")
stra=replace(stra,">",">")
stra=replace(stra,"'","")
stra=replace(stra,"(","(")
stra=replace(stra,")",")")
stra=replace(stra,";",";")
stra=replace(stra,",",",")
stra=replace(stra,"%","%")
stra=replace(stra,"+","+")
chkhtm=stra
end function
function titleb(str,strlen)
dim l,t,c, i
l=len(str)
t=0
for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t+2
else
t=t+1
end if
if t>=strlen then
titleb=left(str,i)&"…"
exit for
else
titleb=str&""
end if
next
end function
columns=request("columns")
if columns="按内容" then
columns="content"
elseif columns="按标题" then
columns="title"
else
columns="addtime"
end if
on error resume next
word=chkhtm(trim(Request("word")))
nnn="<font color='#FF0000'><span style='background-color: #FFFF00'>"&word&"</span></font>"
set rs1=server.CreateObject ("adodb.recordset")
rs1.Open "select distinct(type1) from news where type1='"&rs("type1")&"'",conn,0,1
if word="" then
sql = "select * from news where 1=2 order by id desc"
elseif columns="title" or columns="content" then
sql = "select * from news where title like '%"&word&"%' order by id desc"
elseif len(word)=4 then
sql= "select * from news where addtime >#" & word & "-1-1# and addtime<#" & word+1 & "-1-1#" & " order by id desc"
else
sql= "select * from news where addtime >#" & word & "-1# and addtime<(#" & word & "-1#+30)" & " order by id desc"
end if
rs1.open sql,conn,1,1
if rs1.eof and rs1.bof then
response.write "<p align='center'>请输入正确的表达式 年-月</p>"
i=0
do while not rs1.eof
end if
rs1.close
set rs1=nothing
%>
<!--#include file = admin_conn.asp -->
<%
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "select distinct(type) from [config]",conn,0,1
if rs.recordcount<>0 then
sotop=rs("sotop")
sobottom=rs("sobottom")
end if
rs.close
set rs=nothing
Response.Write sotop
%>
<%
function chkhtm(stra)
stra=replace(stra,"<","<")
stra=replace(stra,">",">")
stra=replace(stra,"'","")
stra=replace(stra,"(","(")
stra=replace(stra,")",")")
stra=replace(stra,";",";")
stra=replace(stra,",",",")
stra=replace(stra,"%","%")
stra=replace(stra,"+","+")
chkhtm=stra
end function
function titleb(str,strlen)
dim l,t,c, i
l=len(str)
t=0
for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t+2
else
t=t+1
end if
if t>=strlen then
titleb=left(str,i)&"…"
exit for
else
titleb=str&""
end if
next
end function
columns=request("columns")
if columns="按内容" then
columns="content"
elseif columns="按标题" then
columns="title"
else
columns="addtime"
end if
on error resume next
word=chkhtm(trim(Request("word")))
nnn="<font color='#FF0000'><span style='background-color: #FFFF00'>"&word&"</span></font>"
if word="" then
sql = "select * from news where 1=2 order by id desc"
elseif columns="title" or columns="content" then
sql = "select * from news where title like '%"&word&"%' order by id desc"
elseif len(word)=4 then
sql= "select * from news where addtime >#" & word & "-1-1# and addtime<#" & word+1 & "-1-1#" & " order by id desc"
else
sql= "select * from news where addtime >#" & word & "-1# and addtime<(#" & word & "-1#+30)" & " order by id desc"
end if
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1
if err.number<>0 then
response.Write "<script>alert('请输入正确的表达式 年-月');history.go(-1);</script>"
end if
if rs.recordcount<>0 then

page=int(request.QueryString ("page"))
rs.PageSize=10
pagecount=rs.pagesize
if page<=0 then page=1
if request.QueryString("page")="" then page=1
rs.AbsolutePage=page
%>
<%
for i=0 to pagecount
sql2 = "select * from lm where id="&rs("lm")
Set rs2 = Server.CreateObject("ADODB.RecordSet")
rs2.Open sql2,conn,1,1
lm=rs2("lm")
title=replace(rs("title"),word,nnn)
nr=replace(nr,"<","<")
nr=replace(nr,">",">")
content=nr
%>
<%
if len(content)<400 then
Response.Write content
Else
Response.Write titleb(content,190)
end if
%>
<%
rs.movenext
if rs.eof then exit for
next
else
response.write "<center><BR><BR><BR>无记录<BR><BR><BR><BR>"
end if
%>
<%
Response.Write sobottom
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
因为字数太多,所有不让发,这个是完整的代码!麻烦大家帮忙看看哦
,看看这个代码那不对?偶写的这个页是搜索两个数据库,addtime为时间,content为内容,title为标题.看看这个代码那不对?两个数据库里都有表news并且都有addtime,content,tietle这三个字段.但现在测试就是不能通过.帮偶改下哦.

你的代码有什么问题,怎么不说啊?这样漫无目的的怎么看啊?