27
May

var TestVal1 = ProductData.Fields(”Category”)

var TestVal2 = ProductData.Fields(”Menu”)

var Heading = ProductData.Fields(Category”)

var Item = ProductData.Fields(”Menu”)

while(Heading == TestVal1)

{

TestVal2 = ProductData.Fields(”Menu”)

Response.Write(”…

Response.Write(”…

while(Item == TestVal2)

{

Item = ProductData.Fields(”Menu”)

TestVal1 = ProductData.Fields(”Category”)

if(Item == TestVal2)

{

ProductData.MoveNext

}

}

}

Example data:

Category Menu

All the Nuts Almonds

All the Nuts Boiled Peanuts

All the Nuts Boiled Peanuts

All the Nuts Candied Nuts

All the Nuts Candied Nuts

Other Delights Candy

Other Delights Candy

Any Ideas, not a connection problem! Data is there and sorted!


Answer:
I assume ProductData is an ADODB.Recordset? If so, test its EOF property before calling MoveNext, and also test it in the outer loop, unless this is in a function from which you can return (otherwise it could run forever.)

if (ProductData.EOF)

   break;

Alternatively, wrap the whole thing in a try/catch block and eat the error, rather than allowing it to be caught by the default handler:

try {

[code that could throw an error]

} catch(e) {

[do nothing, or whatever else to handle the error]

}

In the code above, e is an Error object passed to the handler — it could be called anything that's a legal identifier.

Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList

This entry was posted on Tuesday, May 27th, 2008 at 2:12 am and is filed under Programming. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or TrackBack URI from your own site.

Leave a reply

Name (*)
Mail (*)
URI
Comment