[thelist] ASP help

Michael Robertson mike at mikeemedia.com
Tue Sep 10 12:37:00 CDT 2002


Lots of great tips here, thank you.
Turns out the problem is related to the database. Using code below:

 If objRs("SubText1") <> "" Or Not IsNull(objRs("SubText1")) Then
 blnSub1=True
 varSub1=objRs("SubText1")

In some cases the column SubText1 is blank and in others is NULL. When the
column is actually NULL the page displays fine, but if the column is just
blank it displays the empty table. So it only sets blnSub1 to True is the
columnm is NULL not if it's just blank.

Suggestion?

=================================================

> Thank you for the tips, I will try that.
>
> To answer your question about the exact nature of my problem: The table
was
> always appearing whether or not blnSub1 was True or False. The data inside
> the table was working right, I was just not able to get rig of the empty
> table when there was no data.
>
> Thanks again
>


>
>
> > >I'm trying to get these tables to write to a page only if the condition
> is
> > True. The information stored in varSub1 and
> > >varSub2 are only dispalyed when True but the table itself always
appears
> > regardless of condition. Why is this and is there a >way around it.
Thanks
> >
> > Maybe I don't quite understand your problem. I added the two blnSub and
> > varSub variables and it worked just fine -- varSub1 was displayed when
> > blnSub1 was true, and vice-versa.
> >
> > BTW much better to rewrite this code to be more modular -- right now
> there's
> > a lot of duplication.
> >
> > Also, without seeing the rest of your code, the variable names blnSub#
and
> > varSub# seem to be very generic names. You may want to consider renaming
> > them as well?
> >
> > Try this code:  (watch for wrapping)
> >
> > <%
> > blnSub1 = False
> > blnSub2 = True
> >
> > varSub1 = 1
> > varSub2 = 2
> >
> > If blnSub1 then
> >   DisplayTip varSub1
> > ElseIf blnSub2 then
> >   DisplayTip varSub2
> > End If
> >
> > Sub DisplayTip( s )
> > 'Displays a tip table.
> > 'Accepts: s. String to display.
> >   With Response
> >     .Write "<table border='0' cellspacing='1' cellpadding='4'
> > style='background-color: #ccc; width: 150px;'>"
> >       .Write "<tr>"
> >         .Write "<td style='background-color: #56428b; font-size: 11px;
> > font-weight: bold; color: white; text-align: center;'>Tip</td>"
> >       .Write "</tr>"
> >       .Write "<tr>"
> >         .Write "<td style='background-color: #fff; font-size: 11px;
> > font-weight: bold; color: #ff400; text-align: left;'>"
> >           .Write s
> >         .Write "</td>"
> >       .Write "</tr>"
> >     .Write "</table>"
> >   End With
> > End Sub
> > %>
> >
> > The point is to encapsulate the "grunt-work" logic (the subroutine) and
> keep
> > your working logic at as high a level of abstraction as possible so the
> code
> > is more understandable and maintainable. Call it "at-a-glance" coding.
:)
> >
> > HTH,
> > -dave
> > --
> > For unsubscribe and other options, including
> > the Tip Harvester and archive of thelist go to:
> > http://lists.evolt.org Workers of the Web, evolt !
> >
> >
>
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !
>





More information about the thelist mailing list