下面一段程序怎么老抱错??帮我看看呀,大瞎!(30分)

  • 主题发起人 主题发起人 foxmail
  • 开始时间 开始时间
F

foxmail

Unregistered / Unconfirmed
GUEST, unregistred user!
<%
u_input=request("u_input")
u_ip=request.servervariables("remote_addr")
set conn=Server.CreateObject("ADODB.Connection")
conn.open"DSN=poll;UID=sa;PWD=sa"

sql= "select distinctrow sum(selection1) as sum_selection1, "
sql= sql &amp;
"sum(selection2) AS sum_selection2, sum(selection3) AS sum_selection3, sum(selection4) AS sum_selection4,"
sql= sql &amp;
" count(*) AS total_votes "
sql= sql &amp;
"FROM wanyong;"
set rs=Server.Createobject("ADODB.Recordset")
rs.open sql

total1=rs("sum_selection1")
total2=rs ("sum_selection2")
total3=rs("sum_selection3")
total4=rs ("sum_selection4")
count=rs("total_votes")
if count=0 then
count=1
%>
<br>
<center>
<h2>结果:</h2>
</center>
<p align="center">很好:有<%=total1%>人,占
<%= formatnumber((total1/count)*100,1) %>%<img src="red.jpg" height="10" width="<%= (total1/count)*100 %>">
<p align="center">较好:有<%=total2%>人,占
<%= formatnumber((total2/count)*100,1) %>%<img src="yellow.jpg" height="10" width="<%= (total2/count)*100 %>"><br>
一般:有<%=total3%>人,占
<%= formatnumber((total3/count)*100,1) %>%<img src="green.jpg" height="10" width="<%= (total3/count)*100 %>"><br>
较差:有<%=total4%>人,占
<%= formatnumber((total4/count)*100,1) %>%<img src="blue.jpg" height="10" width="<%= (total4/count)*100 %>"><br>
<BR>
<BR>
共有投票人: <%= formatnumber(count,0,0) %><br>

你来自: <%= u_ip %>
<% set rs=nothing%>
<br>
<input type=button value="关闭" onclick="window.close();"></p>
 
错误提示是什么?
 
Adodb.recordset无法用于执行,可以已别关闭!(15行)
 
注释rs.open sql这行语句
你的数据库在何时打开?
 
去掉这句语句肯定不行,提示:错误类型,adodb.recordset在对应所需
名称或序数的集合中,未找到项目。(17行)
 
我觉得好象是参数没有加对
试试以下代码
set rsobj=server.createobject("adodb.recordset")
'response.write sql
rsobj.open sql,conn,1,1

 
>>set rs=Server.Createobject("ADODB.Recordset")
>>rs.open sql
set rs=conn.execute sql
 
rs.open sql//改行错误,rs没设置database connection
rs.open sql ,conn, adOpenStatic
 
set rs=Server.Createobject("ADODB.Recordset")
rs.open sql,conn,1,1
 
发现一个可以 免费发短信 的网站,给各位难兄难弟解解饿!
www.517yn.net

www.517yn.net/sms/web/ (主站)
但目前只支持移动互发!用联通手机的再等等吧!
 
后退
顶部