Advertisement

04.21.2008 at 11:41PM PDT, ID: 23341997
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.8

Classic ASP:  Error using a "while Loop" within a "while Loop" for a DB result set

Asked by speedygonzalez in Active Server Pages (ASP), VB Script

Tags:

Hello,
      I am creating a content management system for a website.
      This content management system allows dynamic_elements to be created, which are stored within a db table called "dynamic_Element".
I have various types of dynamic elements, such as "Main Heading", "Sub Headings", "Paragraph's", "Hyperlinks", "Images", and "bullet point lists".

All content are stored in the "dynamic_element" table except from "Bullet_point's" which have a seperate table "bullet_point"
Therefore for a bullet point, one dynamic_element is created, and for this one dynamic_element is has many bullet_points.

I execute a query as follows to return the results

"SELECT dynamic_element.*, bullet_point.* from dynamic_element LEFT OUTER JOIN bullet_point on dynamic_element.dynamic_Element_Key = bullet_point.bullet_Point_List_Key where dynamic_element.page_Key =3 order by order_In_Page asc, bullet_point.bullet_Point_Key asc;"

My result set is returned as per attached excel file "query-result.xls" (view this file for results).

I then loop through the result set in my web_page, and for dynamic_element_type of 4 (bullet_point_list) i then try to loop though all the ullet_points relating to this dynamic_element, however I recieve an error as follows:

Script error detected at line 324.
Source line: while objRS("dynamic_Element_Key") = objRS("bullet_Point_List_Key")
Script details:
314
315 elseif objRS("dynamic_Element_Type_Key") = 4 then
316
317 Response.Write " " & vbCrLf
318 Response.Write " "
319 Response.Write objRS("text")
320 Response.Write "" & vbCrLf
321 Response.Write " " & vbCrLf
322
323
324
325 while objRS("dynamic_Element_Key") = objRS("bullet_Point_List_Key")
326
327
328 Response.Write " " & vbCrLf
329 Response.Write "

"
330 Response.Write objRS("bullet_Point_Text")
331 Response.Write " " & vbCrLf
332 Response.Write " " & vbCrLf
333
334 objRS.MoveNext

-> My source code (without the sql query) is as per the attached code snippet.

Do you know how I can avoid such errors and loop through my bullet_points ok?
Do you possibly see where my code error lies?

Any help would be appreciated.

Kind Regards,

Speedy!Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
<%
  if objRS.EOF then
 
%>
				  <h3><font color="#0000FF">No Current Live Content:</font></h3>
				  <a href=<%= "addDynamicElement.asp?elementOrder=1&page_Key="&page_Key %>>Add Dynamic Element Content </a><br><br>
 
<%
  else 
%>
                       <table> 
<%
   if Cint(objRSLiveStatus("resCount")) > 0 then                        
%>
        <a href=<%= "publish.asp?&page_Key="&page_Key %>><font color="#0000FF"><b>Click Here to Publish page (Content has been altered since last publishing)</b></font></a><br><br>
        <!--<a href=<%= "addDynamicElement.asp?elementOrder=1&page_Key="&page_Key %> class="ordlink1">View Current Live Page</a><br><br>-->
        <!--<a href=<%= "addDynamicElement.asp?elementOrder=1&page_Key="&page_Key %> class="ordlink1">Preview Page non Published Content</a><br><br><br><br>-->
<%
   else
%>    
				<h3><font color="#0000FF">Note All Content Below Is Currently Live:</font></h3>
<%
   end if
%>
       <a href=<%= "addDynamicElement.asp?elementOrder=1&page_Key="&page_Key %>>Add Dynamic Element At Postion 1</a><br><br>
<%
 
    while not objRS.EOF
      elementOrder = objRS("order_In_Page") + 1
      if objRS("dynamic_Element_Type_Key") = 1 then 
 
%>
 
	    <h3><font color=A40036><%= objRS("text") %></font></h3>
 
        <a href=<%= "deleteDynamicElement1.asp?elementOrder=" & objRS("order_In_Page") & "&page_Key="&page_Key&"&dynamic_Element_Key="&objRS("dynamic_Element_Key")&"&dynamic_Element_Type_Key=1" %>>Delete Above Dynamic Element</a><br><br><br><br>
        <a href=<%= "addDynamicElement.asp?elementOrder="&elementOrder&"&page_Key="&page_Key %>>Add Dynamic Element Here</a><br><br>
<%
      elseif objRS("dynamic_Element_Type_Key") = 2 then 
%> 
        <h4><font color=A40036><%= objRS("text") %></font></h4>
    
        <a href=<%= "deleteDynamicElement1.asp?elementOrder=" & objRS("order_In_Page") & "&page_Key="&page_Key&"&dynamic_Element_Key="&objRS("dynamic_Element_Key")&"&dynamic_Element_Type_Key=2" %>>Delete Above Dynamic Element</a><br><br><br><br>
	    <a href=<%= "addDynamicElement.asp?elementOrder="&elementOrder&"&page_Key="&page_Key %>>Add Dynamic Element Here</a><br><br>
<%
      elseif objRS("dynamic_Element_Type_Key") = 3 then 
%> 
        <p><%= objRS("text")%></p> 
 
        <a href=<%= "deleteDynamicElement1.asp?elementOrder=" & objRS("order_In_Page") & "&page_Key="&page_Key&"&dynamic_Element_Key="&objRS("dynamic_Element_Key")&"&dynamic_Element_Type_Key=3"  %>>Delete Above Dynamic Element</a><br><br><br><br>
	    <a href=<%= "addDynamicElement.asp?elementOrder="&elementOrder&"&page_Key="&page_Key %>>Add Dynamic Element Here</a><br><br>
<%   
      elseif objRS("dynamic_Element_Type_Key") = 4 then              
%> 
        <%= objRS("text") %>
    
<%
 
 
        while objRS("dynamic_Element_Key") = objRS("bullet_Point_List_Key")
        
%> 
          <li><%= objRS("bullet_Point_Text") %></li> 
        
<%
          objRS.MoveNext
        wend  
 
%>
        <br><br><a href=<%= "deleteDynamicElement1.asp?elementOrder=" & objRS("order_In_Page") & "&page_Key="&page_Key&"&dynamic_Element_Key="&objRS("dynamic_Element_Key")&"&dynamic_Element_Type_Key=4"  %>>Delete Above Dynamic Element</a><br><br><br><br>
	    <a href=<%= "addDynamicElement.asp?elementOrder="&elementOrder&"&page_Key="&page_Key %>>Add Dynamic Element Here</a><br><br>
<%    
      elseif objRS("dynamic_Element_Type_Key") = 5 then 
%> 
 
        <a href="<%= objRS("filename") %>" class="ordlink1" target="_blank"><%= objRS("text") %></a><br><br>
        
        <a href=<%= "deleteDynamicElement1.asp?elementOrder=" & objRS("order_In_Page") & "&page_Key="&page_Key&"&dynamic_Element_Key="&objRS("dynamic_Element_Key")&"&dynamic_Element_Type_Key=5"  %>>Delete Above Dynamic Element</a><br><br><br><br>
	    <a href=<%= "addDynamicElement.asp?elementOrder="&elementOrder&"&page_Key="&page_Key %>>Add Dynamic Element Here</a><br><br>
<%
      else 
      
        'determine width + height of image + resize if too large.      
        Set fso = Server.CreateObject("Scripting.FileSystemObject") 
        imgPath = "../../images/dynamic/" & objRS("filename")
        Set binImg = loadpicture(Server.MapPath(imgPath))
        dblWidth = round(((96 * binImg.width)/2540),0)
        dblHeight = round(((96 * binImg.height)/2540),0)   
        set binImg = nothing
        set fso = nothing                                  
 
       if Cint(dblWidth) > 400 then 
%> 
	  <img src="../../images/dynamic/<%= objRS("filename") %>" alt="<%=objRS("text") %>"  width="395"><br><br>
<%
      else
%>
	  <img src="../../images/dynamic/<%= objRS("filename") %>" alt="<%=objRS("text") %>"><br><br>
 
<%           
      end if
 
%>
        <a href=<%= "deleteDynamicElement1.asp?elementOrder=" & objRS("order_In_Page") & "&page_Key="&page_Key&"&dynamic_Element_Key="&objRS("dynamic_Element_Key")&"&dynamic_Element_Type_Key=6" %>>Delete Above Dynamic Element</a><br><br><br><br> 
	    <a href=<%= "addDynamicElement.asp?elementOrder="&elementOrder&"&page_Key="&page_Key %>>Add Dynamic Element Here</a><br><br>
<%
       end if
       objRS.MoveNext
     wend
%>
 
 
			      </table>
<%
  objConn.Close
 
  end if   
%>
Attachments:
 
excel result set
 
[+][-]04.21.2008 at 11:46PM PDT, ID: 21408559

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 11:46PM PDT, ID: 21408560

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 12:01AM PDT, ID: 21408607

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Active Server Pages (ASP), VB Script
Tags: Classic ASP
Sign Up Now!
Solution Provided By: pratima_mcs
Participating Experts: 3
Solution Grade: B
 
 
[+][-]04.22.2008 at 12:04AM PDT, ID: 21408622

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 12:24AM PDT, ID: 21408705

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 12:32AM PDT, ID: 21408732

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 02:13AM PDT, ID: 21409189

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 02:17AM PDT, ID: 21409201

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 02:26AM PDT, ID: 21409250

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:46AM PDT, ID: 21411021

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 04:53AM PDT, ID: 21419557

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.08.2008 at 09:42PM PDT, ID: 21741040

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628