错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E31)
[Microsoft][ODBC SQL Server Driver]超时已过期
/search.asp, 第 68 行
第68行 :rs.open "select * from nyeee_company where ("&sql&") order by tuijian desc,sequence desc,id desc",conn,1,3
附整段搜索代码:<%
keyword=replace(keyword," "," ")
keyword=replace(keyword,"'","")
keyword=replace(keyword,"[","")
keyword=replace(keyword,"]","")
keywordlist=split(keyword,chr(32))
for i=0 to ubound(keywordlist)
sql=sql &" nyeee_company.company like '%" & keywordlist(i) & "%' and "
next
sql=Left(SQL,(LEN(SQL)-4))
set rs=server.createobject("adodb.recordset")
rs.open "select * from nyeee_company where ("&sql&") order by tuijian desc,sequence desc,id desc",conn,1,3
%>
10 个解决方案
#1
是不是你的数据库的记录比较多 而且你查询的条件又很多 所以搜索的效率不高 导致搜索超时
#2
建议用command执行一下看看
set command=server.createobject("adodb.command")
command.commandtype=1
command.commandtimeout=120
command.commandtext=你的sql语句
rs.open command,,1,1
set command=server.createobject("adodb.command")
command.commandtype=1
command.commandtimeout=120
command.commandtext=你的sql语句
rs.open command,,1,1
#3
<%
keyword=replace(keyword," "," ")
keyword=replace(keyword,"'","")
keyword=replace(keyword,"[","")
keyword=replace(keyword,"]","")
keywordlist=split(keyword,chr(32))
for i=0 to ubound(keywordlist)
sql=sql &" nyeee_company.company like '%" & keywordlist(i) & "%' and "
next
sql=Left(SQL,(LEN(SQL)-4))
set rs=server.createobject("adodb.recordset")
rs.open "select * from nyeee_company",conn,1,3
%>
这样运行就不超时,
<%
keyword=replace(keyword," "," ")
keyword=replace(keyword,"'","")
keyword=replace(keyword,"[","")
keyword=replace(keyword,"]","")
keywordlist=split(keyword,chr(32))
for i=0 to ubound(keywordlist)
sql=sql &" nyeee_company.company like '%" & keywordlist(i) & "%' and "
next
sql=Left(SQL,(LEN(SQL)-4))
set rs=server.createobject("adodb.recordset")
rs.open "select * from nyeee_company where ( nyeee_company.company like '%网络%' ) order by tuijian desc,sequence desc,id desc",conn,1,3
%>
这样也会超时
keyword=replace(keyword," "," ")
keyword=replace(keyword,"'","")
keyword=replace(keyword,"[","")
keyword=replace(keyword,"]","")
keywordlist=split(keyword,chr(32))
for i=0 to ubound(keywordlist)
sql=sql &" nyeee_company.company like '%" & keywordlist(i) & "%' and "
next
sql=Left(SQL,(LEN(SQL)-4))
set rs=server.createobject("adodb.recordset")
rs.open "select * from nyeee_company",conn,1,3
%>
这样运行就不超时,
<%
keyword=replace(keyword," "," ")
keyword=replace(keyword,"'","")
keyword=replace(keyword,"[","")
keyword=replace(keyword,"]","")
keywordlist=split(keyword,chr(32))
for i=0 to ubound(keywordlist)
sql=sql &" nyeee_company.company like '%" & keywordlist(i) & "%' and "
next
sql=Left(SQL,(LEN(SQL)-4))
set rs=server.createobject("adodb.recordset")
rs.open "select * from nyeee_company where ( nyeee_company.company like '%网络%' ) order by tuijian desc,sequence desc,id desc",conn,1,3
%>
这样也会超时
#4
upup 求解
#5
sql语句输出后拷贝下来到SQL查询分析器执行下,查下慢在哪里?
#6
是因为太慢,所以才导致超时。
那个like 尽量少用。
那个like 尽量少用。
#7
这段代码应该怎样改才好啊?
#8
upup
#9
"select * from nyeee_company where
("&sql&") order by tuijian desc,sequence desc,id desc"
为什么只有值而没有指定条件?
应该指定一下条件如:
"select * from nyeee_company where sequence = ("&sql&") order by tuijian desc,sequence desc,id desc"
为什么只有值而没有指定条件?
应该指定一下条件如:
"select * from nyeee_company where sequence = ("&sql&") order by tuijian desc,sequence desc,id desc"
#10
upup
#1
是不是你的数据库的记录比较多 而且你查询的条件又很多 所以搜索的效率不高 导致搜索超时
#2
建议用command执行一下看看
set command=server.createobject("adodb.command")
command.commandtype=1
command.commandtimeout=120
command.commandtext=你的sql语句
rs.open command,,1,1
set command=server.createobject("adodb.command")
command.commandtype=1
command.commandtimeout=120
command.commandtext=你的sql语句
rs.open command,,1,1
#3
<%
keyword=replace(keyword," "," ")
keyword=replace(keyword,"'","")
keyword=replace(keyword,"[","")
keyword=replace(keyword,"]","")
keywordlist=split(keyword,chr(32))
for i=0 to ubound(keywordlist)
sql=sql &" nyeee_company.company like '%" & keywordlist(i) & "%' and "
next
sql=Left(SQL,(LEN(SQL)-4))
set rs=server.createobject("adodb.recordset")
rs.open "select * from nyeee_company",conn,1,3
%>
这样运行就不超时,
<%
keyword=replace(keyword," "," ")
keyword=replace(keyword,"'","")
keyword=replace(keyword,"[","")
keyword=replace(keyword,"]","")
keywordlist=split(keyword,chr(32))
for i=0 to ubound(keywordlist)
sql=sql &" nyeee_company.company like '%" & keywordlist(i) & "%' and "
next
sql=Left(SQL,(LEN(SQL)-4))
set rs=server.createobject("adodb.recordset")
rs.open "select * from nyeee_company where ( nyeee_company.company like '%网络%' ) order by tuijian desc,sequence desc,id desc",conn,1,3
%>
这样也会超时
keyword=replace(keyword," "," ")
keyword=replace(keyword,"'","")
keyword=replace(keyword,"[","")
keyword=replace(keyword,"]","")
keywordlist=split(keyword,chr(32))
for i=0 to ubound(keywordlist)
sql=sql &" nyeee_company.company like '%" & keywordlist(i) & "%' and "
next
sql=Left(SQL,(LEN(SQL)-4))
set rs=server.createobject("adodb.recordset")
rs.open "select * from nyeee_company",conn,1,3
%>
这样运行就不超时,
<%
keyword=replace(keyword," "," ")
keyword=replace(keyword,"'","")
keyword=replace(keyword,"[","")
keyword=replace(keyword,"]","")
keywordlist=split(keyword,chr(32))
for i=0 to ubound(keywordlist)
sql=sql &" nyeee_company.company like '%" & keywordlist(i) & "%' and "
next
sql=Left(SQL,(LEN(SQL)-4))
set rs=server.createobject("adodb.recordset")
rs.open "select * from nyeee_company where ( nyeee_company.company like '%网络%' ) order by tuijian desc,sequence desc,id desc",conn,1,3
%>
这样也会超时
#4
upup 求解
#5
sql语句输出后拷贝下来到SQL查询分析器执行下,查下慢在哪里?
#6
是因为太慢,所以才导致超时。
那个like 尽量少用。
那个like 尽量少用。
#7
这段代码应该怎样改才好啊?
#8
upup
#9
"select * from nyeee_company where
("&sql&") order by tuijian desc,sequence desc,id desc"
为什么只有值而没有指定条件?
应该指定一下条件如:
"select * from nyeee_company where sequence = ("&sql&") order by tuijian desc,sequence desc,id desc"
为什么只有值而没有指定条件?
应该指定一下条件如:
"select * from nyeee_company where sequence = ("&sql&") order by tuijian desc,sequence desc,id desc"
#10
upup