在应使用条件的上下文(在 'and' 附近)中指定了非布尔类型的表达式。

fcksj 2015-10-15 08:17:04
Microsoft OLE DB Provider for SQL Server 错误 '80040e14'
在应使用条件的上下文(在 'and' 附近)中指定了非布尔类型的表达式。

flagIndex = 0
nowstartdate=request("startdate")
if nowstartdate="" then
nowstartdate=date()-day(date()-1)
end if
nowenddate=request("enddate")
if nowenddate="" then
nowenddate=date()
end if
sql = "SELECT gys.id as id,gys.company as company,sum(buy.price2) as priceSum,count(gys.id) as nums FROM gys LEFT JOIN buy ON gys.ID = buy.id_gys where 1=1 and buy.zu and buy.isok and buy.price2<>0 "
if request.Cookies("shiwei_id")<>1 and lookbuysell="yes" then
sql=sql&" and buy.id_login="&request.Cookies("shiwei_id")
end if
if nowstartdate<>"" then
sql=sql&" and buy.datediff-(d,'"&nowstartdate&"',selldate)>=0"
end if
if nowenddate<>"" then
sql=sql&" and buy.datediff-(d,'"&nowenddate&"',selldate)<=0"
end if
sql=sql&" group by gys.id,gys.company order by sum(buy.price2) desc"

请问高人如何解决啊!
...全文
1558 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Go 旅城通票 2015-10-19
  • 打赏
  • 举报
回复
报什么错误。。你原来的只是指定了字段名称是肯定不行的,要为表达式 如不哦你的zu和isok不是数字类型,要用引号扩起
Go 旅城通票 2015-10-16
  • 打赏
  • 举报
回复
where 1=1 and buy.zu and buy.isok and buy.price2<>0 你红色的字段要加上条件 where 1=1 and buy.zu=1 and buy.isok=1 and buy.price2<>0
fcksj 2015-10-16
  • 打赏
  • 举报
回复
还是不行啊?求助啊!
fcksj 2015-10-15
  • 打赏
  • 举报
回复
Microsoft OLE DB Provider for SQL Server 错误 '80040e14' 在应使用条件的上下文(在 'and' 附近)中指定了非布尔类型的表达式。 /oa/produit/jw_pm.asp,行 105 <% if request.Cookies("shiwei_username")="" then %> <script language="javascript"> top.location.href="../index.asp" </script> <% response.end end if %> <!-- #include file="../conn2.asp" --> <!-- #include file="../const.asp" --> <html> <head> <title><%=dianming%> - 排行榜</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <link href="../style/style.css" rel="stylesheet" type="text/css"> <style> body { background-color:#FFFFFF; } </style> </HEAD> <BODY> <% if fla10="0" and request.Cookies("shiwei_id")<>"1" then %> <br><center><img src="../images/note.gif" align="absmiddle"> <font color="#FF0000">你不具备此权限,请与管理员联系!</font></center> <% response.end end if %> <% '取得搜索关键字 flagIndex = 0 nowstartdate=request("startdate") if nowstartdate="" then nowstartdate=date()-day(date()-1) end if nowenddate=request("enddate") if nowenddate="" then nowenddate=date() end if sql = "SELECT gys.id as id,gys.company as company,sum(buy.price2) as priceSum,count(gys.id) as nums FROM gys LEFT JOIN buy ON gys.ID = buy.id_gys where 1=1 and buy.zu and buy.isok and buy.price2<>0 " if request.Cookies("shiwei_id")<>1 and lookbuysell="yes" then sql=sql&" and buy.id_login="&request.Cookies("shiwei_id") end if if nowstartdate<>"" then sql=sql&" and buy.datediff-(d,'"&nowstartdate&"',selldate)>=0" end if if nowenddate<>"" then sql=sql&" and buy.datediff-(d,'"&nowenddate&"',selldate)<=0" end if sql=sql&" group by gys.id,gys.company order by sum(buy.price2) desc" %> <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED"> <tr> <td><img src="../images/r_1.gif" alt="" /></td> <td width="100%" background="../images/r_0.gif"> <table cellpadding="0" cellspacing="0" width="100%"> <tr> <td> 排行榜</td> <td align="right"> <table width="100%" border="0" cellpadding="0" cellspacing="2" align="center"> <form name="form2"> <tr> <td width="95%" align="right"> 开始日期: <input name="startdate" id="startdate" value="<%=nowstartdate%>" readonly style="width:100px"> <img src="../images/date.gif" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:window.open('day.asp?form=form2&field=startdate&oldDate='+startdate.value,'','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=170,top=150,left=590');"> 结束日期: <input name="enddate" id="enddate" value="<%=nowenddate%>" readonly style="width:100px"> <img src="../images/date.gif" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:window.open('day.asp?form=form2&field=enddate&oldDate='+enddate.value,'','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=170,top=150,left=740');"> <input type="submit" value=" 查询 " class="button">  </td> </tr> </form> </table> </td> </tr> </table> </td> <td><img src="../images/r_2.gif" alt="" /></td> </tr> <tr> <td></td> <td> <form name="form1" action="gys_del.asp"> <table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1"> <tr align="center"> <td class="category" height="30">排名</td> <td class="category">咨询师姓名</td> <td class="category">学生数量</td> <td class="category">总金额(元)</td> <td class="category">详细交易</td> </tr> <% set rs =server.createobject("adodb.recordset") rs.open sql,conn,1,1 do while not rs.eof flagIndex = flagIndex+1 %> <tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''" onDblClick="javascript:var win=window.open('gys_show.asp?id=<%=rs("id")%>','详细信息','width=853,height=470,top=176,left=161,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes'); win.focus()"> <td align="center"><%=flagIndex%></td> <td align="center" height="25"><%=rs("company")%></td> <td align="center"><%=rs("nums")%></td> <td align="center"><%=formatnumber(rs("priceSum"),2)%></td> <td align="center"><input type="button" value="详细交易" onClick="javascript:var win=window.open('gys_buy.asp?id=<%=rs("id")%>&startdate=<%=nowstartdate%>&enddate=<%=nowenddate%>','详细交易','width=853,height=470,top=176,left=161,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes'); win.focus()" class="button"></td> </tr> <% rs.movenext Loop set conn=nothing %> </table></td></tr> </table> </form> </td> <td></td> </tr> <tr> <td><img src="../images/r_4.gif" alt="" /></td> <td></td> <td><img src="../images/r_3.gif" alt="" /></td> </tr> </table> </body> </html>
slwsss 2015-10-15
  • 打赏
  • 举报
回复
and buy.zu =??? and buy.isok=??? and buy.price2<>0 "

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧