AROC
asked on
error '800a01a8' on ASP processing page for rating item
Hi,
I am having problems getting the following form processed on rate.asp and submitted to the database. I have most of elements here and I was hoping someone could help find where I'm getting derailed. ~
This form seems to collect the data alright:
<form name="frmRate<%=Productsrs .Fields.it em("Produc tID").valu e%>" action="rate.asp?ID=<%=Pro ductsrs.Fi elds.item( "ProductID ").value%> " method="post">
<input type="hidden" name="ProductId" value="<%=Productsrs.Field s.item("Pr oductID"). value%>">o mitted for brevity</form>
If I submit it to a page to just display what was posted, it shows the following, which is what was on the form when it was submitted:
Variables passed via QueryString
ID = 1
Variables passed via Post
ProductId = 1
Merchant = 8
Rating = 10
Comment = Test Comment here
frmRate1.x = 33
frmRate1.y = 9
This is rate.asp where I would like to process the results and submit the rating to the database (with connection established with incl.):
<%
Dim ProductId
Dim Rating
Dim Merchant
Dim Comment
Dim IP
Dim cookie
Dim cookieRated
ProductId = Request.querystring("ID")
Rating = Request.Form("Rating")
Merchant = Request.Form("Merchant")
Comment = Request.Form("Comment")
IP = Request.ServerVariables("R EMOTE_ADDR ")
cookie = Request.Cookies("rate_" & ProductId)
if cookie = "" then
cookieRated = false
else
cookieRated = true
end if
%>
<%
Dim RatingRS
Dim RatingRS_numRows
Set RatingRS = Server.CreateObject("ADODB .Recordset ")
RatingRS.ActiveConnection = MM_CharonCart_STRING
RatingRS.Source = "SELECT * FROM Ratings where ProductID = " & ProductID
RatingRS.CursorType = 0
RatingRS.CursorLocation = 2
RatingRS.LockType = 1
RatingRS.Open()
RatingRS_numRows = 0
%>
<%Set MM_Cmd = Server.CreateObject("ADODB .Command")
MM_Cmd.ActiveConnection = MM_CharonCart_STRING
%>
<%
Dim RateCount
<!--Line 49-->RateCount = "SELECT COUNT(*) FROM Ratings WHERE IP='" & IP & "' AND ProductId=" & ProductID
IF RateCount.Value = 0 THEN
IF cookieRated = false THEN
MM_Cmd.CommandText ="INSERT INTO ratings(Rating, Merchant, Comment, IP, ProductId) VALUES(" & Rating & "," & Merchant & ",'" & Comment & "', '" & IP & "', " & ProductID & ")"
MM_Cmd.Execute
Response.Cookies("rate_" & ProductId) = true
Response.Cookies("rate_" & ProductId).expires = Date() + 30
END IF
END IF
%>
Microsoft VBScript runtime error '800a01a8'
Object required: 'SELECT COUNT(*) FROM'
/rate.asp, line 49
Thanks, the help is appreciated.
AROC
I am having problems getting the following form processed on rate.asp and submitted to the database. I have most of elements here and I was hoping someone could help find where I'm getting derailed. ~
This form seems to collect the data alright:
<form name="frmRate<%=Productsrs
<input type="hidden" name="ProductId" value="<%=Productsrs.Field
If I submit it to a page to just display what was posted, it shows the following, which is what was on the form when it was submitted:
Variables passed via QueryString
ID = 1
Variables passed via Post
ProductId = 1
Merchant = 8
Rating = 10
Comment = Test Comment here
frmRate1.x = 33
frmRate1.y = 9
This is rate.asp where I would like to process the results and submit the rating to the database (with connection established with incl.):
<%
Dim ProductId
Dim Rating
Dim Merchant
Dim Comment
Dim IP
Dim cookie
Dim cookieRated
ProductId = Request.querystring("ID")
Rating = Request.Form("Rating")
Merchant = Request.Form("Merchant")
Comment = Request.Form("Comment")
IP = Request.ServerVariables("R
cookie = Request.Cookies("rate_" & ProductId)
if cookie = "" then
cookieRated = false
else
cookieRated = true
end if
%>
<%
Dim RatingRS
Dim RatingRS_numRows
Set RatingRS = Server.CreateObject("ADODB
RatingRS.ActiveConnection = MM_CharonCart_STRING
RatingRS.Source = "SELECT * FROM Ratings where ProductID = " & ProductID
RatingRS.CursorType = 0
RatingRS.CursorLocation = 2
RatingRS.LockType = 1
RatingRS.Open()
RatingRS_numRows = 0
%>
<%Set MM_Cmd = Server.CreateObject("ADODB
MM_Cmd.ActiveConnection = MM_CharonCart_STRING
%>
<%
Dim RateCount
<!--Line 49-->RateCount = "SELECT COUNT(*) FROM Ratings WHERE IP='" & IP & "' AND ProductId=" & ProductID
IF RateCount.Value = 0 THEN
IF cookieRated = false THEN
MM_Cmd.CommandText ="INSERT INTO ratings(Rating, Merchant, Comment, IP, ProductId) VALUES(" & Rating & "," & Merchant & ",'" & Comment & "', '" & IP & "', " & ProductID & ")"
MM_Cmd.Execute
Response.Cookies("rate_" & ProductId) = true
Response.Cookies("rate_" & ProductId).expires = Date() + 30
END IF
END IF
%>
Microsoft VBScript runtime error '800a01a8'
Object required: 'SELECT COUNT(*) FROM'
/rate.asp, line 49
Thanks, the help is appreciated.
AROC
ASKER
Thanks for reply Dana ~
The database is Access.
Also the page is http://www.neatgift.com/Ratings.asp?ID=1 if anyone's interested or it helps..
AROC
The database is Access.
Also the page is http://www.neatgift.com/Ratings.asp?ID=1 if anyone's interested or it helps..
AROC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks DireOrbAnt, by the sounds of it, that's the problem. I don't understand how to correct it though.
Perhaps I should fire a Newbie alert about now..
If I change IF RateCount.Value = 0 THEN to RateCount = 0 THEN I get
Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: "SELECT COUNT(*) FROM"]'
/rate.asp, line 49
AROC
Perhaps I should fire a Newbie alert about now..
If I change IF RateCount.Value = 0 THEN to RateCount = 0 THEN I get
Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: "SELECT COUNT(*) FROM"]'
/rate.asp, line 49
AROC
ASKER
I see. Thanks.
You need to call the query first. Also, change it to:
"SELECT COUNT(*) AS RateCount FROM Ratings WHERE IP='" & IP & "' AND ProductId=" & ProductID
So you can grab RS("RateCount") or something... You are already calling a SELECT * up top but without the IP part in the WHERE clause... And you don't use RatingRS anywhere else... Maybe you need to stick your other query (with AS RateCount) and then do If (RS("RateCount")) = 0
Again, I'm not sure what you are trying to do and I don't know if all the code is there, so hard to tell.
You just can't query SQL results before first opening a recordset with the query....
"SELECT COUNT(*) AS RateCount FROM Ratings WHERE IP='" & IP & "' AND ProductId=" & ProductID
So you can grab RS("RateCount") or something... You are already calling a SELECT * up top but without the IP part in the WHERE clause... And you don't use RatingRS anywhere else... Maybe you need to stick your other query (with AS RateCount) and then do If (RS("RateCount")) = 0
Again, I'm not sure what you are trying to do and I don't know if all the code is there, so hard to tell.
You just can't query SQL results before first opening a recordset with the query....
RateCount = "SELECT COUNT(*) FROM <schema_name>.Ratings WHERE IP='" & IP & "' AND ProductId=" & ProductID