你的思路就错了,把下面这段 If keyword <> "" then sql = "select * from Secondinfo where infotype = '"& infotype & "' and (Topic like '%" & Keyword & "%' Or content like '%" & Keyword & "%') Order By Pdate Desc" Else If InfoType="" THen Sql = "select * from Secondinfo Order By pdate Desc" Else Sql = "select * from Secondinfo where infotype = '"& infotype & "' Order By pdate Desc" End IF End If改成打开两个记录集的方式,记得close:如下 If keyword <> "" then set rs = Server.CreateObject("ADODB.Recordset") rs.open "select * from Secondinfo where infotype = '"& infotype & "' and (Topic like '%" & Keyword & "%' Or content like '%" & Keyword & "%') Order By Pdate Desc",conn,3 Else set rs1 = Server.CreateObject("ADODB.Recordset") If InfoType="" THen rs1.open "select * from Secondinfo Order By pdate Desc",conn,3 Else rs1.open "select * from Secondinfo where infotype = '"& infotype & "' Order By pdate Desc",conn,3 End IF End If 最下面记得写 rs1.close rs.close
If keyword <> "" then
sql = "select * from Secondinfo where infotype = '"& infotype & "' and (Topic like '%" & Keyword & "%' Or content like '%" & Keyword & "%') Order By Pdate Desc"
Else
If InfoType="" THen
Sql = "select * from Secondinfo Order By pdate Desc"
Else
Sql = "select * from Secondinfo where infotype = '"& infotype & "' Order By pdate Desc"
End IF
End If改成打开两个记录集的方式,记得close:如下
If keyword <> "" then
set rs = Server.CreateObject("ADODB.Recordset")
rs.open "select * from Secondinfo where infotype = '"& infotype & "' and (Topic like '%" & Keyword & "%' Or content like '%" & Keyword & "%') Order By Pdate Desc",conn,3
Else
set rs1 = Server.CreateObject("ADODB.Recordset")
If InfoType="" THen
rs1.open "select * from Secondinfo Order By pdate Desc",conn,3
Else
rs1.open "select * from Secondinfo where infotype = '"& infotype & "' Order By pdate Desc",conn,3
End IF
End If
最下面记得写
rs1.close
rs.close