很高兴,在经过一个多小时的调试之后,我能得出正确的答案!
<!--#include file="conn.asp"-->
<%'打开数据库%>
<%
dim rs,sql
set rs = server.CreateObject("adodb.recordset")
sql = "select * from votes"
rs.open sql,conn,2,3
%>
<%'把数据库中调出的值赋给变量!%>
<%
dim vo1,vo2,vo3,vo4
vo1 =cint( rs("vote1"))
vo2 = cint(rs("vote2"))
vo3 = cint(rs("vote3"))
vo4 = cint(rs("vote4"))
%>
<%'把从下拉列表中选出的值赋给变量%>
<%
dim v1,v2,v3,v4
v1 = trim(request.Form("vote1"))
v2 = trim(request.Form("vote2"))
v3 = trim(request.Form("vote3"))
v4 = trim(request.Form("vote4"))
%>
<%'数据累加,并写到数据库%>
<%
conn.execute "update votes set vote1 = '"&vo1+1&"' where id="&v1
conn.execute "update votes set vote2 = '"&vo2+1&"' where id="&v2
conn.execute "update votes set vote3 = '"&vo3+1&"' where id="&v3
conn.execute "update votes set vote4 = '"&vo4+1&"' where id="&v4
%>
<%
response.Redirect("viewresult.asp")
%>
<%
rs.close
set rs= nothing
conn.close
set conn=nothing
%>
很高兴,我知道了在asp中update的用法!