Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error with Nested Repeat Regions

Status
Not open for further replies.

lloydmav

Programmer
Dec 13, 2002
7
AU
Hi,

I've been following a tutorial to setup some nested repeat regions on a test page I set up. I would like to repeat the main recordset and then repeat the second recordset within the main rs using a field in the first as a filter. However I get the following error message from the ASP code I added to the table...

Error Type:
Microsoft JScript compilation (0x800A03EE)
Expected ')'
/datatest.asp, line 44, column 11
While (NOT Recordset2.EOF)

Is there something simple I've missed like the tutorial is in vbscript instead of javascript or something?

Thanks

Lloyd

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/iiGymConectionString.asp" -->
<%
var Recordset1_cmd = Server.CreateObject ("ADODB.Command");
Recordset1_cmd.ActiveConnection = MM_iiGymConectionString_STRING;
Recordset1_cmd.CommandText = "SELECT * FROM dbo.tblClassCategory";
Recordset1_cmd.Prepared = true;

var Recordset1 = Recordset1_cmd.Execute();
var Recordset1_numRows = 0;
%>
<%
var Recordset2_cmd = Server.CreateObject ("ADODB.Command");
Recordset2_cmd.ActiveConnection = MM_iiGymConectionString_STRING;
Recordset2_cmd.CommandText = "SELECT * FROM dbo.tblEquip";
Recordset2_cmd.Prepared = true;

var Recordset2 = Recordset2_cmd.Execute();
var Recordset2_numRows = 0;
%>
<%
var Repeat1__numRows = -1;
var Repeat1__index = 0;
Recordset1_numRows += Repeat1__numRows;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>data test page</title>
</head>

<body>
<% while ((Repeat1__numRows-- != 0) && (!Recordset1.EOF)) { %>
<table width="200" border="0">
<tr>
<td><%=(Recordset1.Fields.Item("category_title_webviewable").Value)%></td>
</tr>
<tr>
<td>
<%
FilterParam = Recordset1.Fields.Item("class_category_id").Value
Recordset2.Filter = "classcategory = " & FilterParam
While (NOT Recordset2.EOF)
%>
<%=(Recordset2.Fields.Item("description").value)%>,&nbsp;
<%
Recordset2.MoveNext()
Wend
%>
</td>
</tr>
</table>
<%
Repeat1__index++;
Recordset1.MoveNext();
}
%>
<p>&nbsp;</p>
<p>&nbsp;</p>


<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
<%
Recordset1.Close();
%>
<%
Recordset2.Close();
%>
 
Can you highlight the affected line that it says in your error message?

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
its this line:

While (NOT Recordset2.EOF)

I believe that I probably need to mak the W in while lower case, but eve when I do that I get the same error message on the same line

Thanks

Lloyd
 
It does not matter whether you have lower or upper case. It does, however, matter that you have only one WEND to accompany two WHILE statements. Additionally, you may do better to use the Do/While loop versus the While/Wend. There is some documentation on this forum somewhere, but I don't remember exactly why at the moment...

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
ok thanks, so supposing I were to continue with the while statements for now, where would I place the additional Wend and would this resolve the problem?

Thanks

Lloyd
 
You're shoving VBScript in the middle of a JScript ASP page.

Code:
Recordset2.Filter = "classcategory = " & FilterParam
While (NOT Recordset2.EOF)
%>
<%=(Recordset2.Fields.Item("description").value)%>,&nbsp;
<%
Recordset2.MoveNext()
Wend

Should be

Code:
Recordset2.Filter = "classcategory = " + FilterParam;
while (!Recordset2.EOF)
}
%>
  <%(Recordset2.Fields.Item("description").value)%>,&nbsp;
  <%
  Recordset2.MoveNext();
}

JScript/Javascript is case sensitive, and I don't know of ANY programming language interpreters that will let you mix and match like you did in the example you posted.

Lee
 
thanks for that, I figured some of it must have been vbscript, most tutorial I find tend to be...

I tried the code you posted but it doesn't like the } after the 'while'

Error Type
Microsoft Jscript compilation (0x800A03EA)
Syntax error
/datatest.asp, line 45

 
You gotta think for yourself a little bit here. I made a typographical mistake and used a close curly brace rather than an open one. Change that } after the while to {.

You might have problems with the property Value or value, as well, since you mix and match the spellings in your code.

Lee
 
your right, I managed to work the rest out, thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top