asp中,如果我想做一个站内搜索的效果.该如果写代码?
我要把我整个网站内的关健字内容全部搜索出来.该如何写?问题就是,这个网站内有几个数据库的.如何做啊?急救呀.QQ:199248375求手高救助,本人万分感激!!...
我要把我整个网站内的关健字内容全部搜索出来.该如何写?问题就是,这个网站内有几个数据库的.如何做啊?急救呀.QQ:199248375 求手高救助,本人万分感激!!
展开
3个回答
展开全部
<%
'--------------------------------------------------------连接五个数据库
dim conn,conn1,conn2,conn4
set conn=server.CreateObject("adodb.connection")
conn.open "dbq="&server.MapPath("databases/gdsspt.asp")&";driver={microsoft access driver (*.mdb)};"
set conn1=server.CreateObject("adodb.connection")
conn1.open "dbq="&server.MapPath("databases/gdsspt1.asp")&";driver={microsoft access driver (*.mdb)};"
set conn2=server.CreateObject("adodb.connection")
conn2.open "dbq="&server.MapPath("databases/gdsspt2.asp")&";driver={microsoft access driver (*.mdb)};"
set conn4=server.CreateObject("adodb.connection")
conn4.open "dbq="&server.MapPath("databases/gdsspt4.asp")&";driver={microsoft access driver (*.mdb)};"
'----------------------------------------------------------------------数据库0
dim sql,rs,id
id=request.Form("search")
sql="select * from bigproduct where content LIKE '%"&id&"%'"
set rs=conn.execute(sql)
dim sql1,rs1
sql1="select * from product where content LIKE '%"&id&"%'"
set rs1=conn.execute(sql1)
dim sql2,rs2
sql2="select * from biglinyu where content LIKE '%"&id&"%'"
set rs2=conn.execute(sql2)
dim sql3,rs3
sql3="select * from News where Content LIKE '%"&id&"%'"
set rs3=conn.execute(sql3)
'----------------------------------------------------------------------数据库0
'-------------------------------------------------------------------------数据库1
sql4="select * from product where Content LIKE '%"&id&"%'"
set rs4=conn1.execute(sql4)
sql5="select * from news where Content LIKE '%"&id&"%'"
set rs5=conn1.execute(sql5)
'-------------------------------------------------------------------------数据库1
'-------------------------------------------------------------------------数据库2
sql6="select * from product where Content LIKE '%"&id&"%'"
set rs6=conn2.execute(sql6)
sql7="select * from News where Content LIKE '%"&id&"%'"
set rs7=conn2.execute(sql7)
'-------------------------------------------------------------------------数据库2
'-------------------------------------------------------------------------数据库4
sql8="select * from News where Content LIKE '%"&id&"%'"
set rs8=conn4.execute(sql8)
'-------------------------------------------------------------------------数据库4
%>
'--------------------------------------------------------连接五个数据库
dim conn,conn1,conn2,conn4
set conn=server.CreateObject("adodb.connection")
conn.open "dbq="&server.MapPath("databases/gdsspt.asp")&";driver={microsoft access driver (*.mdb)};"
set conn1=server.CreateObject("adodb.connection")
conn1.open "dbq="&server.MapPath("databases/gdsspt1.asp")&";driver={microsoft access driver (*.mdb)};"
set conn2=server.CreateObject("adodb.connection")
conn2.open "dbq="&server.MapPath("databases/gdsspt2.asp")&";driver={microsoft access driver (*.mdb)};"
set conn4=server.CreateObject("adodb.connection")
conn4.open "dbq="&server.MapPath("databases/gdsspt4.asp")&";driver={microsoft access driver (*.mdb)};"
'----------------------------------------------------------------------数据库0
dim sql,rs,id
id=request.Form("search")
sql="select * from bigproduct where content LIKE '%"&id&"%'"
set rs=conn.execute(sql)
dim sql1,rs1
sql1="select * from product where content LIKE '%"&id&"%'"
set rs1=conn.execute(sql1)
dim sql2,rs2
sql2="select * from biglinyu where content LIKE '%"&id&"%'"
set rs2=conn.execute(sql2)
dim sql3,rs3
sql3="select * from News where Content LIKE '%"&id&"%'"
set rs3=conn.execute(sql3)
'----------------------------------------------------------------------数据库0
'-------------------------------------------------------------------------数据库1
sql4="select * from product where Content LIKE '%"&id&"%'"
set rs4=conn1.execute(sql4)
sql5="select * from news where Content LIKE '%"&id&"%'"
set rs5=conn1.execute(sql5)
'-------------------------------------------------------------------------数据库1
'-------------------------------------------------------------------------数据库2
sql6="select * from product where Content LIKE '%"&id&"%'"
set rs6=conn2.execute(sql6)
sql7="select * from News where Content LIKE '%"&id&"%'"
set rs7=conn2.execute(sql7)
'-------------------------------------------------------------------------数据库2
'-------------------------------------------------------------------------数据库4
sql8="select * from News where Content LIKE '%"&id&"%'"
set rs8=conn4.execute(sql8)
'-------------------------------------------------------------------------数据库4
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询