注册 登录
编程论坛 ASP技术论坛

这是个为什么啊

kombel 发布于 2011-07-31 15:29, 777 次点击
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
ODBC 驱动程序不支持所需的属性。
/admin/paylist1.asp, 第 14 行
程序代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Connections/conn.asp" -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.>
<html xmlns="http://www.>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body><%cx = request("cx")

 sql
="select sum(pric) as income from pay where author like '%"&cx& "%' order by id desc"
set rs=server.createobject("adodb.recordset")'
  rs.open sql,conn,1,1%>

 <%if rs.bof then

response.write
"<td align='center'><strong>对不起!没有相关的记录</strong></td>"
response.end
end if%><%income1=(rs("income"))
    response.Write(income1)
%>
</body>


</html>

14 回复
#2
kombel2011-07-31 15:30
sql="select sum(pric) as income from pay where author like '%"&cx& "%' order by id desc"
这一段是这样写的吧
#3
dzt00012011-07-31 22:47
既然是求和了,还要 order by id desc这个干什么?删了试试
#4
kombel2011-08-01 10:15
回复 3楼 dzt0001
嗯  删除了是可了
但是我想实现(如图)
只有本站会员才能查看附件,请 登录
数据库
只有本站会员才能查看附件,请 登录

现在没有思路了   代码该怎么写呢
#5
dzt00012011-08-01 11:03
怎么不一下子说清楚?你这个叫分类汇总,不要一上来就是一个代码,起码说明白要做什么事。

是不是要单价和数量数量相乘后,按NO汇总?
#6
kombel2011-08-01 11:46
回复 5楼 dzt0001
嗯  对  办法没有想到   要怎么写呢
#7
dzt00012011-08-01 11:47
回复 6楼 kombel
sql="select [no], sum(quantity*price) as totalamount from pay group by [no]"
#8
kombel2011-08-01 15:08
回复 7楼 dzt0001
程序代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Connections/conn.asp" -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.>
<html xmlns="http://www.>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<p>
  <%cx = request("cx")
sql
="select no, sum(quantity*price) as totalamount from pay group by no"
set rs=server.createobject("adodb.recordset")'
  rs.open sql,conn,1,1%>
  <%if rs.bof then

response.write
"<td align='center'><strong>对不起!没有相关的记录</strong></td>"
response.end
end if%>
<%
do while not rs.eof           
   response.write rs(
"totalamount")     
rs.movenext         
loop
rs.close           
set rs=nothing           
%>



</body>


</html>


会提示这个
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
ODBC 驱动程序不支持所需的属性。
/admin/paylist1.asp, 第 16 行
#9
dzt00012011-08-01 15:47
no的中括号怎么删掉了?
#10
kombel2011-08-01 15:59
回复 9楼 dzt0001
加上中括号还是一个样啊   这下是16行了 怎么回事呢

[ 本帖最后由 kombel 于 2011-8-1 16:14 编辑 ]
#11
sky2222011-08-01 16:14
sql="select no,sum(quantity*price) as totalamount from pay group by no"
是啥数据库?
#12
kombel2011-08-01 16:20
回复 11楼 sky222
acc的
#13
dzt00012011-08-01 16:38
仔细看了你的数据库截图,原来是pric不是price,改一下SQL吧
#14
kombel2011-08-01 16:47
回复 13楼 dzt0001
那个中括号有什么用的  
#15
dzt00012011-08-01 16:58
no是SQL保留字
1