错误 '80040e21' ODBC 驱动程序不支持所需的属性

来源:百度知道 编辑:UC知道 时间:2024/06/21 09:09:15
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'
ODBC 驱动程序不支持所需的属性。

/search.asp,行30

<%
Set rs= Server.CreateObject("ADODB.Recordset")
if otype="title" then
sql="select top 20 * from NEWS where title Like '%"&key&"%' order by id desc"
elseif otype="msg" then
sql="select top 20 * from NEWS where content Like '%"&key&"%' order by id desc"
else
end if
rs.open sql,conn,1,1 (这是第30行)
if rs.eof and rs.bof then
response.write "<p align='center'>对不起,没有找到相关新闻</p>"
else
%>

上面所示是一个搜索得代码,第一个select语句是按标题搜索,第二个select是按内容搜索,但在搜索得时候如果按标题搜索就正常,按内容就显示上面得错误.什么原因呢??

还要,如果我把数据库得内容表"content"的数据类型改为"文本"的话也会正常"备注"就会这样

你看一下你数据库中,有没有"msg"这个字段.
elseif otype="msg" then
sql="select top 20 * from NEWS where content Like '%"&key&"%' order by id desc"
这句两个查询条件字段不一致
otype="msg"
where content
你检查一下数据库的字段,依依核对一下!