What you're remembering is an inconsistency with memo fields, where the
first reference to them clears them.
This would actually result in a different display ...
If DeptName <> rs.fields("teachDept1") then %>
<tr><td colspan=2> <%= rs.fields("teachdept1") %> </td></tr>
<% end if %>
First reference to the field is the IF statement. Test is true and field is
cleared. Second reference is the value of the <td>. Field is now blank, so
you get an empty cell.
I speak from bitter memory. I hadn't heard of the limitation, and it took
me about an hour to discover what was hapenning to my code. In my case it
was:
if field <> "" then
append the field to something I was going to display later
I had myself convinced that either the IF was succeeding when it shouldn't,
or I simply was doing something wrong in appending the information or
displaying the stuff later.
Then I'd put a diagnostic display in and the IF would promptly change what
it was doing. So I'd take it out again, etc.
It took me far too long to work out what was actually going on. :-(
Dave S
----- Original Message -----
From: Paul Manzotti
To: [email protected]
Sent: Saturday, July 30, 2005 8:09 AM
Subject: Re: [ASP] Assistance with Records display
acschnabel wrote:
>I'm trying to display my staff members by department, not have to
>repeat the department name in the table. Currently, the data appears
>as follows
>
>
I can't quite remember, but doesn't calling a field from a recordset
"wipe" that field for that row, i.e. you can only call a field once per
row? Probably not. It's been a long time since I last used a recordset
in that manner (see getrows and arrays). Try a response.write of
DeptName at the beginning and end of the code within the loop, which
will show you what the if statement is using. I suggest putting the
current field dept name into DeptName at the start of each iteration of
the loop, and use LastDept to store the last dept shown, and compare
those two. I imagine that it's good practice to minimise the number of
calls to the recordset, so if you are going to be using a field more
than once in a loop, chuck it into a variable and then use that.
Anyway, regardless of that, you should do a search on getrows, and look
to use an array rather than recordsets. And don't use Select * in sql
queries.
HTH
manzo
---------------------------------------------------------------------
Home : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post : [email protected]
Subscribe : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
YAHOO! GROUPS LINKS
Visit your group "active-server-pages" on the web.
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12hffjkkc/M=362335.6886445.7839731.1510227/D=groups/S=1705115381:TM/Y=YAHOO/EXP=1122690503/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/">In
low income neighborhoods, 84% do not own computers. At Network for Good, help
bridge the Digital Divide!</a>.</font>
--------------------------------------------------------------------~->
---------------------------------------------------------------------
Home : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post : [email protected]
Subscribe : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/active-server-pages/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/