紧急求教?如何将用asp编写的在线投票系统中的单选投票变成多选投票?

紧急求教?如何将用asp编写的在线投票系统中的单选投票变成多选投票?,第1张

分类: 电脑/网络 >>程序设计 >>其他编程语言

问题描述:

页面代码如下:<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>

<!--#include file="Connections/connVoteSystem" -->

<%

if(Request("voteitem_id") <>"") then Command1__send_id = Request("voteitem_id")

end if

%>

<%

Dim RecVote__MMColParam

RecVote__MMColParam = "1"

If (Request.QueryString("voteitem_id") <>"") Then

RecVote__MMColParam = Request.QueryString("voteitem_id")

End If

%>

<%

Dim RecVote

Dim RecVote_numRows

Set RecVote = Server.CreateObject("ADODB.Recordset")

RecVote.ActiveConnection = MM_connVoteSystem_STRING

RecVote.Source = "SELECT * FROM voteShow WHERE voteitem_id = " + Replace(RecVote__MMColParam, "'", "''") + ""

RecVote.CursorType = 0

RecVote.CursorLocation = 2

RecVote.LockType = 1

RecVote.Open()

RecVote_numRows = 0

%>

<%

if Session("voteOK") <>1 then

set Command1 = Server.CreateObject("ADODB.Command")

Command1.ActiveConnection = MM_connVoteSystem_STRING

Command1.CommandText = "UPDATE voteItem SET vote_count = vote_count + 1 WHERE voteitem_id = " + Replace(Command1__send_id, "'", "''") + " "

Command1.CommandType = 1

Command1.CommandTimeout = 0

Command1.Prepared = true

Command1.Execute()

Session("voteOK") = 1

end if

%>

<%

Dim MM_paramName

%>

<%

' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone

Dim MM_keepURL

Dim MM_keepForm

Dim MM_keepBoth

Dim MM_removeList

Dim MM_item

Dim MM_nextItem

' create the list of parameters which should not be maintained

MM_removeList = "&index="

If (MM_paramName <>"") Then

MM_removeList = MM_removeList &"&" &MM_paramName &"="

End If

MM_keepURL=""

MM_keepForm=""

MM_keepBoth=""

MM_keepNone=""

' add the URL parameters to the MM_keepURL string

For Each MM_item In Request.QueryString

MM_nextItem = "&" &MM_item &"="

If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then

MM_keepURL = MM_keepURL &MM_nextItem &Server.URLencode(Request.QueryString(MM_item))

End If

Next

' add the Form variables to the MM_keepForm string

For Each MM_item In Request.Form

MM_nextItem = "&" &MM_item &"="

If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then

MM_keepForm = MM_keepForm &MM_nextItem &Server.URLencode(Request.Form(MM_item))

End If

Next

' create the Form + URL string and remove the intial '&' from each of the strings

MM_keepBoth = MM_keepURL &MM_keepForm

If (MM_keepBoth <>"") Then

MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)

End If

If (MM_keepURL <>"") Then

MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)

End If

If (MM_keepForm <>"") Then

MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)

End If

' a utility function used for adding additional parameters to these strings

Function MM_joinChar(firstItem)

If (firstItem <>"") Then

MM_joinChar = "&"

Else

MM_joinChar = ""

End If

End Function

我将页面上的变成了复选框,但是出现如下错误:

查询语法错误,voteitem_id=27,26,?

votesystem/votecount/25行

解析:

你对于ASP懂的多吗?

单选的上传一条信息到服务器

复选是上传多条。接收数据那需要多个变量来接收

然后上传到数据库的时候也要多个变量

把这个弄好就行了

网上也有很多好的投票系统的,推荐

chinaz

两个表吧,一个(发表人,论题,论题ID),第二个(论题ID,选项ID,选项内容,投票总计)

觉得建两个表的可扩展能力比较好,维护性好一点.

建一个表的话也可以.查询速度应该影响不大.个人意见.

src里放的是java源码。。他要是没用到java文件就无所谓了,要是用到java文件,class文件给你了(class文件在web-inf的classes里),也没有问题,要是用到了java文件,但是没给你类src里又没有class文件,就不能用了。

数据库也可以直接在jsp里访问的。

能不能运行你试一下不就知道了。。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/9257362.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-26
下一篇 2023-04-26

发表评论

登录后才能评论

评论列表(0条)

保存