当前位置:编程学习 > VB >>

Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'

Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21' 

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

/Products.asp,行 187 

187行为: rs.open exec,conn,1,1




<%
BigClassID=request.QueryString("BigClassID")
SmallClassID=request.QueryString("SmallClassID")
if  not isnumeric(BigClassID)  or not isnumeric(SmallClassID) then
Response.Write "<script>alert('警告!请勿尝试注入!');history.go(-1);</script>" 
Response.End()
end if
set rs=server.createobject("adodb.recordset") 
if BigClassID="" then
exec="select  * from products order by px_id asc"
end if
if BigClassID<>"" then
exec="select  * from products where BigClassID="&BigClassID&" by px_id asc"
end if
if BigClassID<>"" and SmallClassID<>"" then
exec="select   * from products where BigClassID="&BigClassID&" and SmallClassID="&SmallClassID&" by px_id asc"
end if
rs.open exec,conn,1,1
if rs.eof then
response.Write "<div style=""padding:10px"">暂无产品!</a>"
else
rs.PageSize =""&config("productsclass")&""
iCount=rs.RecordCount 
iPageSize=rs.PageSize
maxpage=rs.PageCount 
page=request("page")
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif  page>maxpage then
page=maxpage
end if
rs.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if
end if
For i=1 To x
%> --------------------编程问答-------------------- exec="select * from products where BigClassID="&BigClassID&" by px_id asc"
改为
exec="select * from products where BigClassID=" & BigClassID & " by px_id asc"


注意&连接符之间的空格,



-----------------------------
女子女子穴习,二人二人向下下同! --------------------编程问答--------------------
引用 1 楼 xiaolinyouni 的回复:
exec="select * from products where BigClassID="&BigClassID&" by px_id asc"
改为

VB code

exec="select * from products where BigClassID=" & BigClassID & " by px_id asc"


注意&……
 没用的。。。 --------------------编程问答-------------------- 哇还没注意呢,原来是还有防止动网注入的一段,我想起了4/5年前那个懵懂的计算机时代

请楼主检查conn连接字段,并对变量全部定义,然后检测表名,字段名是否与exec对应,在打开conn和rs前加上if XX.state<>0 then XX.close



-----------------------------
女子女子穴习,二人二人向下
补充:VB ,  基础类
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,