日期:2014-05-17  浏览次数:20971 次

asp语句 mdb数据库 字段定义给变量 where 字段 变量写时出错
<% set rs= Server.CreateObject("adodb.recordset")
rs.open "select * from z_product where id="&myrequest("id",1),conn,1,3
class2=rs("simclass") 
if not rs.eof then %>



............................


<% set rs= Server.CreateObject("adodb.recordset")
rs.open "select top 20 simpicture,cntitle,simclass,id from z_product where simclass=class2 and simpicture<>'' order by [top] desc,listnum desc,id desc",conn,1,1
do while not rs.eof %>

------解决方案--------------------
rs.open "select top 20 simpicture,cntitle,simclass,id from z_product where simclass='"&class2&"' and simpicture<>'' order by [top] desc,listnum desc,id desc",conn,1,1


试试
------解决方案--------------------
看看你表中字段类型,simclass,simpicturep这两个字段是什么类型。
数值型的不用加'',字符型的需要加''
------解决方案--------------------
rs.open "select top 20 simpicture,cntitle,simclass,id from z_product where simclass="&class2&" and simpicture<>'' order by [top] desc,listnum desc,id desc",conn,1,1