473,320 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Microsoft VBScript runtime (0x800A01A8) Object Required: "

66
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

Expand|Select|Wrap|Line Numbers
  1. <%@LANGUAGE="VBSCRIPT"%>
  2. <!--#include file="Connections/music_world.asp" -->
  3.  
  4.  
  5.  
  6. <%
  7. Dim Recordset1
  8. Dim Recordset1_cmd
  9. Dim Recordset1_numRows
  10.  
  11. Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
  12. Recordset1_cmd.ActiveConnection = MM_music_world_STRING
  13. Recordset1_cmd.CommandText = "SELECT * FROM tbl_cds" 
  14. Recordset1_cmd.Prepared = true
  15.  
  16. Set Recordset1 = Recordset1_cmd.Execute
  17. Recordset1_numRows = 0
  18. %>
  19.  
  20. <%
  21. dim rs1
  22. dim avgRating
  23. dim avgWhole
  24. dim decPart
  25. dim decCalc
  26. dim finalRating
  27. dim altText
  28. %>
  29.  
  30. <%
  31. Dim Repeat1__numRows
  32. Dim Repeat1__index
  33.  
  34. Repeat1__numRows = 5
  35. Repeat1__index = 0
  36. Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
  37. %>
  38. <html>
  39. <head>
  40. <title>Untitled Document</title>
  41. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  42. <style type="text/css">
  43. <!--
  44. .style1 {
  45.     color: #FF6633;
  46.     font-weight: bold;
  47. }
  48. -->
  49. </style>
  50.  
  51. </head>
  52. <body>
  53.  
  54. <p align="left" class="style1">Full CD catalogue</p>
  55. <hr><hr>
  56. <p align="left" class="style1">&nbsp;</p>
  57. <div align="left">
  58.  
  59.  
  60. <%
  61.  
  62. function ShowRating(cdid)
  63.  
  64. const MIN_RATINGS_BEFORE_SHOW = 1
  65.  
  66. dim Recordset2
  67. dim avgRating
  68. dim avgWhole
  69. dim decPart
  70. dim decCalc
  71. dim finalRating
  72. dim altText 
  73. dim conn
  74.  
  75. set conn = Server.CreateObject("ADODB.Connection") 
  76. set Recordset2 = Server.CreateObject("ADODB.Recordset")
  77.  
  78. conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\ddwassignment2\music_world.mdb"
  79.  
  80. Recordset2 = "SELECT SUM(rating), COUNT(*) FROM ratings WHERE cdid = " & cdid
  81.  
  82.  
  83.  
  84. 'This CD has ratings, let's display the average
  85. avgRating = Recordset2.Fields(0).Value / Recordset2.Fields(1).Value 
  86.  
  87. if Instr(1, CStr(avgRating), ".") > 0 then
  88.  
  89. 'The average rating is a decimal, we need to either
  90. 'round the value up/down
  91.  
  92. avgWhole = Left(CStr(avgRating), Instr(1, CStr(avgRating), ".")-1)
  93. decPart = Mid(CStr(avgRating), Instr(1, CStr(avgRating), ".")+1, 2)
  94.  
  95. if decPart <> "" then
  96. 'Work out whether or not we have to round this
  97. 'rating up or down
  98.  
  99. if CInt(decPart) >= 5 then
  100. decCalc = .5
  101. else
  102. decCalc = 0
  103. end if
  104.  
  105. finalRating = CInt(avgWhole) + CCur(decCalc)
  106.  
  107. else
  108. finalRating = avgRating
  109. end if
  110. else
  111. finalRating = avgRating
  112. end if 
  113.  
  114. 'Setup the alt text for the images
  115. altText = "Average visitor rating of " & finalRating & " out of 5"
  116.  
  117. for i = 1 to CInt(finalRating)
  118. Response.Write "<img alt='" & altText & "' src='rating_on.gif'>"
  119. next
  120.  
  121. if CInt(finalRating) <> finalRating then
  122. 'This article has a .5 rating, such as 5.5
  123. Response.Write "<img alt='" & altText & "' src='rating_half.gif'>"
  124.  
  125. for i = CInt(finalRating)+2 to 10
  126. Response.Write "<img alt='" & altText & "' src='rating_off.gif'>"
  127. next
  128. else
  129. for i = CInt(finalRating)+1 to 10
  130. Response.Write "<img alt='" & altText & "' src='rating_off.gif'>"
  131. next
  132. end if 
  133. end function
  134.  
  135. if CInt(finalRating) <> finalRating then
  136. 'This article has a .5 rating, such as 5.5
  137. Response.Write "<img alt='" & altText & "' src='rating_half.gif'>"
  138.  
  139.  
  140. %>
  141.  
  142. <h2><%=Recordset2.Fields(0).Value%></h2>
  143.  
  144. <br>
  145. <br>  
  146. <%end if%>
  147. <%
  148. While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) 
  149. %> 
  150.  <table width="52%" border="0" cellspacing="4" cellpadding="0">
  151.     <tr>
  152.     <td width="39%" rowspan="6" align="left" valign="top"><img src="images\album_pics\<%=(Recordset1.Fields.Item("cd_image").Value)%>">
  153.     <tr>
  154.       <tr>
  155.         <td width="39%" rowspan="6" align="left" valign="top">&nbsp;</td>
  156.         <td width="28%"><strong>Album:</strong></td>
  157.         <td width="33%"><div align="left"><%=(Recordset1.Fields.Item("cd_title").Value)%></div></td>
  158.       </tr>
  159.       <tr>
  160.         <td><strong>Artist:</strong></td>
  161.         <td><div align="left"><%=(Recordset1.Fields.Item("artist_name").Value)%></div></td>
  162.       </tr>
  163.       <tr>
  164.         <td><strong>Release date:</strong></td>
  165.         <td><div align="left"><%=(Recordset1.Fields.Item("release_date").Value)%></div></td>
  166.       </tr>
  167.       <tr>
  168.         <td><strong>Genre:</strong></td>
  169.         <td><div align="left"><%=(Recordset1.Fields.Item("music_genre").Value)%></div></td>
  170.       </tr>
  171.       <tr>
  172.         <td><p><strong>Artist Biography</strong>:</p></td>
  173.       </tr>
  174.       <tr>
  175.         <td colspan="3"></td>
  176.       <tr>
  177.         <td align="left" valign="top"><%=(Recordset1.Fields.Item("artist_biography").Value)%></td>
  178.         <td colspan="3">&nbsp;</td>
  179.       <tr>
  180.         <td colspan="5" align="left" valign="top"><div align="right">Rated: <%=ShowRating(Recordset2.Fields(0).Value)%>
  181.  
  182.       </div></td>
  183.       <tr>
  184.         <td colspan="4" align="left" valign="top">
  185.           <form name="frmRate<%=recordset1.Fields(0).value%>" action="rate.asp" method="post">
  186.           <input type="hidden" name="cdid" value="<%=(recordset1.Fields(0).value)%>">
  187.             <table width="100%" border="0" cellspacing="0" cellpadding="0">
  188.             <tr>
  189.                 <td colbgcolor="white">
  190.                   <p><font face="Verdana" size="3" color="orange">
  191.                     Dont buy this
  192.                     <input type ="radio" name="rating" value="1" >
  193.                     <input type ="radio" name="rating" value="2" >
  194.                     <input type ="radio" name="rating" value="3" >
  195.                     <input type ="radio" name="rating" value="4" >
  196.                     <input type ="radio" name="rating" value="5" >
  197.                       You must buy this
  198.  
  199.                     <p>
  200.                     <input type="submit" value="Rate It!">            
  201.                   </p></td>
  202.             </tr>
  203.             </table>  
  204.           </form></td>
  205.       <tr>
  206.         <td colspan="4" align="left" valign="top"><hr></td>
  207.     </table>
  208.  
  209.     <div align="right"></div>
  210.     <% 
  211.   Repeat1__index=Repeat1__index+1
  212.   Repeat1__numRows=Repeat1__numRows-1
  213.   Recordset1.MoveNext()
  214. Wend
  215. %>
  216. </div>
  217. <p>&nbsp;Next</p>
  218. </body>
  219. </html>
  220. <%
  221. Recordset1.Close()
  222. Recordset2.Close()
  223. Set Recordset1 = Nothing
  224. Set Recordset2 = Nothing
  225. %>
  226. <%
  227.  
  228.  
  229. %>
  230.  
  231.  
  232.  
Jan 17 '08 #1
10 7954
idsanjeev
241 100+
Hi Jasone
Try to add where are you excute at line 80 and don't get any error at line 16


Expand|Select|Wrap|Line Numbers
  1. conn, adOpenStatic, adLockReadOnly, adCmdText
let me know if it work
Jan 17 '08 #2
jasone
66
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:

Expand|Select|Wrap|Line Numbers
  1.  
  2. set conn = Server.CreateObject("ADODB.Connection") 
  3. set Recordset2 = Server.CreateObject("ADODB.Recordset")
  4.  
  5. conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\ddwassignment2\music_wor  ld.mdb"
  6.  
  7. Recordset2 = "SELECT SUM(rating), COUNT(*) FROM ratings WHERE cdid = " & cdid
  8. Recordset2 = conn, adOpenStatic, adLockReadOnly, adCmdText
  9.  
  10.  
  11. 'This CD has ratings, let's display the average
  12. avgRating = Recordset2.Fields(0).Value / Recordset2.Fields(1).Value 
  13.  
  14.  

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 !
Jan 17 '08 #3
idsanjeev
241 100+
Hi
try use same place
Expand|Select|Wrap|Line Numbers
  1. R.Open Recordset2, conn, adOpentatic, adLockReadOnly, adCmdTextS
Jan 17 '08 #4
jasone
66
Hi, thanks once again for your reply, it has reverted back to the object required error on line 180!
Jan 17 '08 #5
jasone
66
Hi, thanks once again for your reply, it has reverted back to the object required error on line 180!
Jan 17 '08 #6
idsanjeev
241 100+
hi
try to also add this code for your first recordset open at line 16
Jan 17 '08 #7
jasone
66
sorry, no effect by adding this line
Jan 17 '08 #8
idsanjeev
241 100+
Hi
I think line 180 has no any error so plz try to
Remove line then check in which line report error
thanks
Jan 18 '08 #9
jasone
66
Hi, thanks for all your help, it was decided to leave this out of the system due to lack of time
Feb 12 '08 #10
markrawlingson
346 Expert 100+
Ok, But FYI I just saw this post and here's your problem..

Expand|Select|Wrap|Line Numbers
  1.  
  2. set Recordset2 = Server.CreateObject("ADODB.Recordset")
  3.  
  4. conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\ddwassignment2\music_wor  ld.mdb"
  5.  
  6. Recordset2 = "SELECT SUM(rating), COUNT(*) FROM ratings WHERE cdid = " & cdid
  7.  
  8.  
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.

Expand|Select|Wrap|Line Numbers
  1.  
  2. conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\ddwassignment2\music_wor  ld.mdb"
  3.  
  4. sSQL = "SELECT SUM(rating), COUNT(*) FROM ratings WHERE cdid = " & cdid
  5.  
  6. Set RecordSet2 = Server.CreateObject("ADODB.RecordSet")
  7.  
  8. RecordSet2.Open sSQL, Conn, adOpenReadOnly, adLockOptimistic, adCmdText
  9.  
  10.  
Now that you have an open recordset object, it should work.

Sincerely,
Mark
Feb 13 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

3
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...
1
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...
1
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...
1
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' ...
1
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. ...
4
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...
1
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...
4
nitindel
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
0
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
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...
1
isladogs
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...
0
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...
1
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...
1
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....
0
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...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.