读书人

帮忙看看有关问题出哪了阿

发布时间: 2012-04-23 13:17:38 作者: rapoo

帮忙看看问题出哪了阿?
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'

ODBC 驱动程序不支持所需的属性。

/search.asp,行 549



dim connstr2
connstr2="DBQ="+server.mappath("../database/mydb.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr2

set rs=server.CreateObject("adodb.recordset")

dim bigclass,smallclass,sheng,shi,name
bigclass=trim(request("anclassid"))
smallclass=trim(request("nclassid"))
sheng=trim(request("dsheng"))
shi=trim(request("dshi"))
jiage=trim(request("jiage"))
name=trim(request("searchkey"))
name=replace(name,"'","''")

Sql= " Select * from shop_books where 1=1 "

if bigclass<>0 then

select case action
case "1"

if bigclass <>"" then
sql= sql & " and anclassid= '"&bigclass&"'"
end if
if smallclass <>"" then
sql= sql & " and nclassid= '"&smallclass&"'"
end if
if sheng <>"" then
sql= sql & " and dsheng= '"&sheng&"'"
end if
if shi <>"" then
sql= sql &" and dshi= '"&shi&"'"
end if
if name <>"" then
sql= sql &" and bookname like '%"&name&"%' and huiyuanjia<"&jiage&" "
end if


case "2"

if bigclass <>"" then
sql= sql & " and anclassid= '"& bigclass &"'"
end if
if smallclass <>"" then
sql= sql & " and nclassid= '"& smallclass &"'"
end if
if sheng <>"" then
sql= sql & " and dsheng= '"& sheng &"'"
end if
if shi <>"" then
sql= sql&" and dshi= '"& shi &"'"
end if
if name <>"" then
sql= sql&" and pingpai like '%"& selectname &"%' and huiyuanjia<"&jiage&" "
end if


case "3"

if bigclass <>"" then
sql= sql & " and anclassid= '"& bigclass &"'"
end if
if smallclass <>"" then
sql= sql & " and nclassid= '"& smallclass &"'"
end if
if sheng <>"" then
sql= sql & " and dsheng= '"& sheng &"'"
end if
if shi <>"" then
sql= sql&" and dshi= '"& shi &"'"
end if
if name <>"" then
sql= sql&" and bookzz like '%"& selectname &"%' and huiyuanjia<"&jiage&" "
end if


case "4"

if bigclass <>"" then
sql= sql & " and anclassid= '"& bigclass &"'"
end if
if smallclass <>"" then
sql= sql & " and nclassid= '"& smallclass &"'"


end if
if sheng <>"" then
sql= sql & " and dsheng= '"& sheng &"'"
end if
if shi <>"" then
sql= sql&" and dshi= '"& shi &"'"
end if
if name <>"" then
sql= sql&" and bookcontent like '%"& name &"%' and huiyuanjia<"&jiage&" "
end if

case else

end select
end if
------549行------ rs.open sql,conn,1,1


[解决办法]
你自己试着
RESPONSE.WRITE SQL
看SQL的值是什么
[解决办法]
检查一下:
1. 链接成功与否
2. 语句是否有问题。把SQL语句打印出来看看。在数据库的环境运行一下就知道是否有问题。
3. 就算是在数据库环境通过,也要检查是否有保留字,ODBC可能会检查保留字是否被使用的。

读书人网 >ASP

热点推荐