473,837 Members | 1,561 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Microsoft VBScript runtime (0x800A01A8) Object Required: "

66 New Member
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 8053
idsanjeev
241 New Member
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 New Member
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 New Member
Hi
try use same place
Expand|Select|Wrap|Line Numbers
  1. R.Open Recordset2, conn, adOpentatic, adLockReadOnly, adCmdTextS
Jan 17 '08 #4
jasone
66 New Member
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 New Member
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 New Member
hi
try to also add this code for your first recordset open at line 16
Jan 17 '08 #7
jasone
66 New Member
sorry, no effect by adding this line
Jan 17 '08 #8
idsanjeev
241 New Member
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 New Member
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

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

Similar topics

3
7298
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 JavaScript showempname(), and it will then look up the name by executing SQL statement. However, the following code has the following error: Microsoft VBScript runtime (0x800A01A8) Object required on line " sqlStmt = "select * from employee where...
1
4819
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 try to create test.asp and put it in wwwroot folder only code I had was <% Response.write Session.SessionID %>
1
8967
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 when the page is run off the intranet server. I'm using IIS 5, I.E. 6 and WinXP Pro. Here's the code it doesn't like:
1
4180
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' /ifaximport.asp, line 13 Here is the code that generates the error:
1
2769
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. Got this error when I tried to run a very basic page... code:
4
8850
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 cant see any errors with this code please assist. Thanks in advance. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
1
3890
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 Days" name=revisit-after> <META content=info@siderinternational.com name=email> <META content="Omer Safdar" name=author> <META content=MegaStudios.com name=publisher> <META content="Copyright ©2005 - MegaStudios.com" name=copyright> <SCRIPT...
4
2530
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
9695
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10902
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10583
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7013
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5680
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4481
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4060
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.