cs3mw
02-17-2009, 12:16 PM
Hi im new to asp coding so if anyone could help me with this it would be a great help. I have the following code
<!--#INCLUDE FILE="connection.asp" -->
<%
DIM objRS
dim strSql
Set objRS = Server.Createobject("ADODB.Connection")
objRS.open mydb
strSql = "INSERT INTO PollSubmit(PollID, rating) VALUES ('2', '" & Request.Form("rating") & "')"
objRS.Execute(strSql)
dim dbConn
dim strSql1
strSql1 = "SELECT COUNT(*) AS poll1 FROM PollSubmit WHERE PollID='2' AND rating='1'"
Set results1 = dbConn.Execute(strSql1)
'This section works out the number of users who have responded with choice 1 as a percentage. The multiplication by 4 is simply to make the bars look bigger
dim percentage1
dim width1
percentage1 = Round((results1("poll1")/200) * 100)
width1 = Round((((10/200) * 100)*4),0)
'This section works out the number of users who have responded with choice 2 as a percentage. The multiplication by 4 is simply to make the bars look bigger
dim percentage2
dim width2
percentage2 = Round((80/200) * 100)
width2 = Round((((80/200) * 100)*4),0)
'This section works out the number of users who have responded with choice 3 as a percentage. The multiplication by 4 is simply to make the bars look bigger
dim percentage3
dim width3
percentage3 = Round((20/200) * 100)
width3 = Round((((20/200) * 100)*4),0)
'This section works out the number of users who have responded with choice 4 as a percentage. The multiplication by 4 is simply to make the bars look bigger
dim percentage4
dim width4
percentage4 = Round((90/200) * 100)
width4 = Round((((90/200) * 100)*4),0)
%>
The error I am getting is located in the block of text in red and the error I am getting is
microsoft vbscript runtime error '800a01a8'
object required: "
/submitpoll.asp line 16
Any help would be greatly appreciated.
<!--#INCLUDE FILE="connection.asp" -->
<%
DIM objRS
dim strSql
Set objRS = Server.Createobject("ADODB.Connection")
objRS.open mydb
strSql = "INSERT INTO PollSubmit(PollID, rating) VALUES ('2', '" & Request.Form("rating") & "')"
objRS.Execute(strSql)
dim dbConn
dim strSql1
strSql1 = "SELECT COUNT(*) AS poll1 FROM PollSubmit WHERE PollID='2' AND rating='1'"
Set results1 = dbConn.Execute(strSql1)
'This section works out the number of users who have responded with choice 1 as a percentage. The multiplication by 4 is simply to make the bars look bigger
dim percentage1
dim width1
percentage1 = Round((results1("poll1")/200) * 100)
width1 = Round((((10/200) * 100)*4),0)
'This section works out the number of users who have responded with choice 2 as a percentage. The multiplication by 4 is simply to make the bars look bigger
dim percentage2
dim width2
percentage2 = Round((80/200) * 100)
width2 = Round((((80/200) * 100)*4),0)
'This section works out the number of users who have responded with choice 3 as a percentage. The multiplication by 4 is simply to make the bars look bigger
dim percentage3
dim width3
percentage3 = Round((20/200) * 100)
width3 = Round((((20/200) * 100)*4),0)
'This section works out the number of users who have responded with choice 4 as a percentage. The multiplication by 4 is simply to make the bars look bigger
dim percentage4
dim width4
percentage4 = Round((90/200) * 100)
width4 = Round((((90/200) * 100)*4),0)
%>
The error I am getting is located in the block of text in red and the error I am getting is
microsoft vbscript runtime error '800a01a8'
object required: "
/submitpoll.asp line 16
Any help would be greatly appreciated.