#1
StringBuilder
http://www.learnasp.com/freebook/learn/literalsrock.aspx
(note)
LiteralOutput.Text = LiteralOutput.Text & "<font face='Verdana'>
size='1'>"
even if you were not using stringbuilder
LiteralOutput.Text &= "<font face='Verdana'> size='1'>"
was better syntax for that.
#2
Also what you are doing below should be done with a repeater.
http://www.learnasp.com/freebook/learn/templates1.aspx
It should not be done with stringbuilder unless you just want to do
this in a very incorrect way faster. Literals were designed for small
things and you are using them for larger tasks that are much cleaner
to represent with repeaters.
#3
For some of your special cases (in your case "standard", "premium")
can be done in repeaters with stupid databinding tricks ala:
http://www.learnasp.com/freebook/learn/databindingtricks.aspx
You need to really wrap your mind around #2 and #3 to take the first
steps towards simplifying the tangled nature of coding ASP, rather
than ASP.net style.
On 6/24/05, Mike Belcher
<[EMAIL PROTECTED]> wrote:
> I wanted to ask some of the gurus here about speed and building output with
> literals. I can and already have this it is a matter of speed. It seems a
> lot slower than aspclassic was but is basically doing the same thing. So
> far
> there are about 750 records that it outputs. This takes a minute with the
> code below. I have a aspclassic site in comparison that outputs 3000
> records
> and does it in 1/10th the time. Is there a way to speed this up? Thanks.
>
>
> <CODE>
> ----------------------------------------------------------------------------
> ----
>
>
> While objDataReader.Read()
>
> 'DATABASE FIELDS
> strTotalSubscribers = strTotalSubscribers + 1
> strUsername = objDataReader("Username")
> strMembershipType = objDataReader("MembershipType")
> strSitenameDB = objDataReader("Sitename")
> strDateJoined = objDataReader("DateJoined")
> strP_Updated = objDataReader("P_Updated")
> strLastPaymentAmount =
> objDataReader("LastPaymentAmount")
> strLastPaymentDate =
> objDataReader("LastPaymentDate")
> strNextPaymentDueDate =
> objDataReader("NextPaymentDueDate")
>
>
>
> 'MembershipType Detection
> If strMembershipType = "Premium Member" Then
> strMembershipType = "<span style='background-color:
> #00FF00'>" & strMembershipType & "</span>"
>
> ElseIf strMembershipType = "Standard Member" Then
>
> Else 'They aren't logged in or aren't a member.
>
> End If
>
>
> 'Is Payment OverDue Detection
> If strNextPaymentDueDate < DateTime.Now().ToShortDateString()
> Then
> strNextPaymentDueDate = "<span style='background-color:
> #FF0000'>" & strNextPaymentDueDate & "</span>"
>
> Else 'They aren't logged in or aren't a member.
>
> End If
>
>
>
> LiteralOutput.Text = LiteralOutput.Text & "<tr>"
> LiteralOutput.Text = LiteralOutput.Text & "<td align='center'
> nowrap>"
>
> LiteralOutput.Text = LiteralOutput.Text & "<font face='Verdana'
> size='1'>"
> LiteralOutput.Text = LiteralOutput.Text & "<a target='_blank'
> href='AdministratorUpdateSubscriber.aspx?username=" &
> strUsername &
> "'>Edit</a></font><b><font face='Verdana' size='1'
> color='#000080'>|</font></b>"
> LiteralOutput.Text = LiteralOutput.Text & "<font face='Verdana'
> size='1'><a target='_blank'
> href='AdministratorDeleteSubscriber.aspx?username=" &
> strUsername &
> "'>Delete</a></font>"
> LiteralOutput.Text = LiteralOutput.Text & "<b><font
> face='Verdana' size='1' color='#000080'>|</font></b>"
> LiteralOutput.Text = LiteralOutput.Text & "<font face='Verdana'
> size='1'><a target='_blank' href='s_profile.aspx?username=" & strUsername &
> "'>View</a></font>"
>
>
> LiteralOutput.Text = LiteralOutput.Text & "</td>"
> LiteralOutput.Text = LiteralOutput.Text & "<td align='center'
> nowrap><font face='Verdana' size='1'><b><a href='s_profile.aspx?username="
> &
> strUsername & "'>" & strUsername & "</a></b></font></td>"
> LiteralOutput.Text = LiteralOutput.Text & "<td width='158'
> align='center' nowrap><font face='Verdana' size='1'>" & strSitenameDB &
> "</font></td>"
> LiteralOutput.Text = LiteralOutput.Text & "<td width='128'
> align='center' nowrap><font face='Verdana' size='1'>" & strMembershipType &
> "</font></td>"
> LiteralOutput.Text = LiteralOutput.Text & "<td width='70'
> align='center' nowrap><font face='Verdana' size='1'>" &
> strLastPaymentAmount
> & "</font></td>"
> LiteralOutput.Text = LiteralOutput.Text & "<td width='86'
> align='center' nowrap><font face='Verdana' size='1'>" & strLastPaymentDate
> &
> "</font></td>"
> LiteralOutput.Text = LiteralOutput.Text & "<td width='78'
> align='center' nowrap><font face='Verdana' size='1'>" &
> strNextPaymentDueDate & "</font></td>"
>
> LiteralOutput.Text = LiteralOutput.Text & "<td width='86'
> align='center' nowrap><font face='Verdana' size='1'>" & strDateJoined &
> "</font></td>"
> LiteralOutput.Text = LiteralOutput.Text & "<td width='78'
> align='center' nowrap><font face='Verdana' size='1'>" & strP_Updated &
> "</font></td>"
>
> End While
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> 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/