在网上找的程序,我的数据库名和地址是:../inc/db/#fonyinLIVE.mdb
记录表格是:FY_Content
希望查询的是:标题(Title)关键字(Keywords)
具体程序如下:
<!--#INCLUDE file="ADOVBS.inc"-->
con="DBQ="+server.mappath("inc/db/#fonyinLIVE.mdb")+";DefaultDir=;DIRVER={microsoft Access Driver(*.mdb)};"
set mycon=server.createobject("ADODB.CONNECTION")
mycon.open.con %>
<% set rs=server.createobject("ADODB.Recordset")
rs.open "SELECT*FORM FY_Content where Title and Keywords like
’%’&request.form("Keywords")&"%’",MyCon,adOpenStatie
%>
<html><head><title>查询结果</title></head>
<body bgcolor="#ffffff">
<p align="center"><br>
asp程序搜索时总提示500错误您查找的资源存在问题,因而无法显示。 请高手帮忙分析错在哪?该怎么改?谢
答案:1 悬赏:30
解决时间 2021-03-01 14:06
- 提问者网友:沉默的哀伤
- 2021-02-28 15:25
最佳答案
- 二级知识专家网友:冷态度
- 2021-02-28 16:22
连接字符串
db="inc/db/#fonyinLIVE.mdb"
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open ConnStr
查询的是标题字段,条件是关键字模糊匹配
SELECT Title FORM FY_Content where Keywords like '%"&request.form("Keywords")&"%’
查询的是所有字段,条件和关键字模糊匹配
LECT Title FORM FY_Content where Title like '%" &request.form("Keywords")&"%' or Keywords like '%" &request.form("Keywords")&"%’
db="inc/db/#fonyinLIVE.mdb"
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open ConnStr
查询的是标题字段,条件是关键字模糊匹配
SELECT Title FORM FY_Content where Keywords like '%"&request.form("Keywords")&"%’
查询的是所有字段,条件和关键字模糊匹配
LECT Title FORM FY_Content where Title like '%" &request.form("Keywords")&"%' or Keywords like '%" &request.form("Keywords")&"%’
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯