hi everyone!
any advice given will be MUCH appreciated, i have spent about 10 hours on this bit of script... a rating system. I am having realt trouble overcoming this problem at runtime
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/ddwassignment2/full_catalogue2.asp, line 180
please find the complete code listing below, i have highlighted line 180... if you spot any other errors please let me know! The function begins on line: 62 -
<%@LANGUAGE="VBSCRIPT"%>
-
<!--#include file="Connections/music_world.asp" -->
-
-
-
-
<%
-
Dim Recordset1
-
Dim Recordset1_cmd
-
Dim Recordset1_numRows
-
-
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
-
Recordset1_cmd.ActiveConnection = MM_music_world_STRING
-
Recordset1_cmd.CommandText = "SELECT * FROM tbl_cds"
-
Recordset1_cmd.Prepared = true
-
-
Set Recordset1 = Recordset1_cmd.Execute
-
Recordset1_numRows = 0
-
%>
-
-
<%
-
dim rs1
-
dim avgRating
-
dim avgWhole
-
dim decPart
-
dim decCalc
-
dim finalRating
-
dim altText
-
%>
-
-
<%
-
Dim Repeat1__numRows
-
Dim Repeat1__index
-
-
Repeat1__numRows = 5
-
Repeat1__index = 0
-
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
-
%>
-
<html>
-
<head>
-
<title>Untitled Document</title>
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-
<style type="text/css">
-
<!--
-
.style1 {
-
color: #FF6633;
-
font-weight: bold;
-
}
-
-->
-
</style>
-
-
</head>
-
<body>
-
-
<p align="left" class="style1">Full CD catalogue</p>
-
<hr><hr>
-
<p align="left" class="style1"> </p>
-
<div align="left">
-
-
-
<%
-
-
function ShowRating(cdid)
-
-
const MIN_RATINGS_BEFORE_SHOW = 1
-
-
dim Recordset2
-
dim avgRating
-
dim avgWhole
-
dim decPart
-
dim decCalc
-
dim finalRating
-
dim altText
-
dim conn
-
-
set conn = Server.CreateObject("ADODB.Connection")
-
set Recordset2 = Server.CreateObject("ADODB.Recordset")
-
-
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\ddwassignment2\music_world.mdb"
-
-
Recordset2 = "SELECT SUM(rating), COUNT(*) FROM ratings WHERE cdid = " & cdid
-
-
-
-
'This CD has ratings, let's display the average
-
avgRating = Recordset2.Fields(0).Value / Recordset2.Fields(1).Value
-
-
if Instr(1, CStr(avgRating), ".") > 0 then
-
-
'The average rating is a decimal, we need to either
-
'round the value up/down
-
-
avgWhole = Left(CStr(avgRating), Instr(1, CStr(avgRating), ".")-1)
-
decPart = Mid(CStr(avgRating), Instr(1, CStr(avgRating), ".")+1, 2)
-
-
if decPart <> "" then
-
'Work out whether or not we have to round this
-
'rating up or down
-
-
if CInt(decPart) >= 5 then
-
decCalc = .5
-
else
-
decCalc = 0
-
end if
-
-
finalRating = CInt(avgWhole) + CCur(decCalc)
-
-
else
-
finalRating = avgRating
-
end if
-
else
-
finalRating = avgRating
-
end if
-
-
'Setup the alt text for the images
-
altText = "Average visitor rating of " & finalRating & " out of 5"
-
-
for i = 1 to CInt(finalRating)
-
Response.Write "<img alt='" & altText & "' src='rating_on.gif'>"
-
next
-
-
if CInt(finalRating) <> finalRating then
-
'This article has a .5 rating, such as 5.5
-
Response.Write "<img alt='" & altText & "' src='rating_half.gif'>"
-
-
for i = CInt(finalRating)+2 to 10
-
Response.Write "<img alt='" & altText & "' src='rating_off.gif'>"
-
next
-
else
-
for i = CInt(finalRating)+1 to 10
-
Response.Write "<img alt='" & altText & "' src='rating_off.gif'>"
-
next
-
end if
-
end function
-
-
if CInt(finalRating) <> finalRating then
-
'This article has a .5 rating, such as 5.5
-
Response.Write "<img alt='" & altText & "' src='rating_half.gif'>"
-
-
-
%>
-
-
<h2><%=Recordset2.Fields(0).Value%></h2>
-
-
<br>
-
<br>
-
<%end if%>
-
<%
-
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
-
%>
-
<table width="52%" border="0" cellspacing="4" cellpadding="0">
-
<tr>
-
<td width="39%" rowspan="6" align="left" valign="top"><img src="images\album_pics\<%=(Recordset1.Fields.Item("cd_image").Value)%>">
-
<tr>
-
<tr>
-
<td width="39%" rowspan="6" align="left" valign="top"> </td>
-
<td width="28%"><strong>Album:</strong></td>
-
<td width="33%"><div align="left"><%=(Recordset1.Fields.Item("cd_title").Value)%></div></td>
-
</tr>
-
<tr>
-
<td><strong>Artist:</strong></td>
-
<td><div align="left"><%=(Recordset1.Fields.Item("artist_name").Value)%></div></td>
-
</tr>
-
<tr>
-
<td><strong>Release date:</strong></td>
-
<td><div align="left"><%=(Recordset1.Fields.Item("release_date").Value)%></div></td>
-
</tr>
-
<tr>
-
<td><strong>Genre:</strong></td>
-
<td><div align="left"><%=(Recordset1.Fields.Item("music_genre").Value)%></div></td>
-
</tr>
-
<tr>
-
<td><p><strong>Artist Biography</strong>:</p></td>
-
</tr>
-
<tr>
-
<td colspan="3"></td>
-
<tr>
-
<td align="left" valign="top"><%=(Recordset1.Fields.Item("artist_biography").Value)%></td>
-
<td colspan="3"> </td>
-
<tr>
-
<td colspan="5" align="left" valign="top"><div align="right">Rated: <%=ShowRating(Recordset2.Fields(0).Value)%>
-
-
</div></td>
-
<tr>
-
<td colspan="4" align="left" valign="top">
-
<form name="frmRate<%=recordset1.Fields(0).value%>" action="rate.asp" method="post">
-
<input type="hidden" name="cdid" value="<%=(recordset1.Fields(0).value)%>">
-
<table width="100%" border="0" cellspacing="0" cellpadding="0">
-
<tr>
-
<td colbgcolor="white">
-
<p><font face="Verdana" size="3" color="orange">
-
Dont buy this
-
<input type ="radio" name="rating" value="1" >
-
<input type ="radio" name="rating" value="2" >
-
<input type ="radio" name="rating" value="3" >
-
<input type ="radio" name="rating" value="4" >
-
<input type ="radio" name="rating" value="5" >
-
You must buy this
-
-
<p>
-
<input type="submit" value="Rate It!">
-
</p></td>
-
</tr>
-
</table>
-
</form></td>
-
<tr>
-
<td colspan="4" align="left" valign="top"><hr></td>
-
</table>
-
-
<div align="right"></div>
-
<%
-
Repeat1__index=Repeat1__index+1
-
Repeat1__numRows=Repeat1__numRows-1
-
Recordset1.MoveNext()
-
Wend
-
%>
-
</div>
-
<p> Next</p>
-
</body>
-
</html>
-
<%
-
Recordset1.Close()
-
Recordset2.Close()
-
Set Recordset1 = Nothing
-
Set Recordset2 = Nothing
-
%>
-
<%
-
-
-
%>
-
-
-
10 7954
Hi Jasone
Try to add where are you excute at line 80 and don't get any error at line 16 - conn, adOpenStatic, adLockReadOnly, adCmdText
let me know if it work
Hi,
Thanks for your reply,
i was a little unsure where you wanted me to try this line of code, and if anything needed to be added removed with the line.
i have added it on line 81, below the sql select statement as shown: -
-
set conn = Server.CreateObject("ADODB.Connection")
-
set Recordset2 = Server.CreateObject("ADODB.Recordset")
-
-
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\ddwassignment2\music_wor ld.mdb"
-
-
Recordset2 = "SELECT SUM(rating), COUNT(*) FROM ratings WHERE cdid = " & cdid
-
Recordset2 = conn, adOpenStatic, adLockReadOnly, adCmdText
-
-
-
'This CD has ratings, let's display the average
-
avgRating = Recordset2.Fields(0).Value / Recordset2.Fields(1).Value
-
-
and i am now getting the following error at run time:
__________________________________________________ _________
Expected end of statement
/ddwassignment2/full_catalogue2.asp, line 81, column 17
Recordset2 = conn, adOpenStatic, adLockReadOnly, adCmdText
adCmdText
__________________________________________________ _________
Thanks for your support !
Hi
try use same place - R.Open Recordset2, conn, adOpentatic, adLockReadOnly, adCmdTextS
Hi, thanks once again for your reply, it has reverted back to the object required error on line 180!
Hi, thanks once again for your reply, it has reverted back to the object required error on line 180!
hi
try to also add this code for your first recordset open at line 16
sorry, no effect by adding this line
Hi
I think line 180 has no any error so plz try to
Remove line then check in which line report error
thanks
Hi, thanks for all your help, it was decided to leave this out of the system due to lack of time
Ok, But FYI I just saw this post and here's your problem.. -
-
set Recordset2 = Server.CreateObject("ADODB.Recordset")
-
-
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\ddwassignment2\music_wor ld.mdb"
-
-
Recordset2 = "SELECT SUM(rating), COUNT(*) FROM ratings WHERE cdid = " & cdid
-
-
You're setting an OBJECT type variable, and then erasing it by setting its value to your SQL Statement - which is a string - thus when you call recordset2.fields(0).value - recordset2 isn't an object, it's a string. Thus - "object required"
Replace the above lines with this and it should work. -
-
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\ddwassignment2\music_wor ld.mdb"
-
-
sSQL = "SELECT SUM(rating), COUNT(*) FROM ratings WHERE cdid = " & cdid
-
-
Set RecordSet2 = Server.CreateObject("ADODB.RecordSet")
-
-
RecordSet2.Open sSQL, Conn, adOpenReadOnly, adLockOptimistic, adCmdText
-
-
Now that you have an open recordset object, it should work.
Sincerely,
Mark
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Matt |
last post by:
The ASP page has a combo box with id list, and when user click the
particular id, it will show the name in the text box. My attempt was when
the user have event on combo box, it will call...
|
by: Matrix |
last post by:
I just got one virtual directory setup and try to run my web application from
there. I am getting following error
Microsoft VBScript runtime error '800a01a8'
Object required: 'Session'
I even...
|
by: Carolyn Speakman |
last post by:
Hi,
I'm trying to amend an intranet .asp page but keep getting this error.
The error only occurs when I pull the WHOLE intranet off the server
and try to run it locally. The error isn't there...
|
by: Erica |
last post by:
Here is the error I get. Line 13 is the 'do while f.AtEndOfStream = false'
line. Your help is very much appreciated!
Microsoft VBScript runtime error '800a01a8'
Object required: 'f'
...
|
by: PaulieS |
last post by:
Hi all.
Am migrating a customer from IIS5 on W2K server to IIS6 on W2K3.
Zipped all the websites and unzipped them to the identical locations
on new server. Used IISMT to migrate metabase.
...
|
by: Genken |
last post by:
Hi can anybody help me i get this error when running this code.
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
And then a line number indicating where the error is, i...
|
by: mudasserrafiq |
last post by:
I am using following asp file default.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="0...
|
by: nitindel |
last post by:
Hi All,
Please let me know that why i am getting the error like this:-
Microsoft VBScript runtime error '800a01a8'
Object required
/Melange/MasconNet/singlesignon.asp, line 49
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |