I have classic asp page. That page create dynamic table using database table. THis code is very efficent code. Becouse it access database only one time. I want convert this page using same technology. Whats the best way to convert this page to dnn module
<html>
<body vlink="#0000FF" alink="#0000FF">
<table border=0 cellspacing="0" cellpadding="0" width=840>
<tr>
<td valign="top">
<%
'Set location to database
sqlState = "DSN=theredzone;UID=theredzone;PWD=dm63146;"
set Conn = Server.CreateObject("ADODB.Connection")
Conn.open sqlstate
'Open Recordset Object
'mysql = "SELECT T.*, H1.PDate, H1.Headline, H1.Link, H1.idno FROM Team AS T, NFLHeadlines AS H1 WHERE T.ShortTeamName = H1.Team AND H1.PDate = (Select Max(PDate) FROM NFLHeadlines AS H2 Where H1.Team = H2.Team) ORDER BY T.Category, T.City, H1.idno;"
mysql = "SELECT NFLTeam.*, H1.PDate, H1.Headline, H1.Link, H1.idno FROM NFLTeam INNER JOIN NFLHeadlines AS H1 ON NFLTeam.ShortTeamName=H1.Team WHERE H1.PDate = (Select Max(PDate) FROM NFLHeadlines Where H1.Team = NFLHeadlines.Team) ORDER BY NFLTeam.Category, NFLTeam.City, NFLTeam.TeamID, H1.idno;"
Set rstemp = conn.Execute( mysql )
' ************************************************************
' support functions for building the "look" of the table
' ************************************************************
Sub ColumnHead( conference )
If UCase(conference) = "AFC" Then fontc="#CC0000" Else fontc="#336699"
%>
<!-- ***** BEGIN <%=conference%> COLUMN **** -->
<td width="50%" valign="top"> <table width="100%" border="2" cellspacing="0" cellpadding="0">
<tr>
<td height="60" valign="top" align="center"> <img src="http://www.theredzone.org/images/<%=conference%>.gif" border="0" align="top"><br>
<strong> <font color="<%=fontc%>" size="4" face="Verdana, Arial, Helvetica, sans-serif"><%=conference%></font>
</strong> </td>
</tr>
<%
End Sub
Sub ColumnFoot
%>
</table></td>
<%
End Sub
Sub TeamHead( color, font, name )
%>
<!-- ****** BEGIN TEAM <%=UCASE(name)%> ****** -->
<tr>
<td width="100%" height="19" bgcolor="<%=color%>" align=center> <font color="<%=font%>" face="Verdana, Arial, Helvetica, sans-serif" size="2">
<strong>
<div align="center"><a name="<%=name%>"></a><%=name%></div>
</strong> </font> </td>
</tr>
<tr>
<td> <table width="100%" border=0 cellpadding=0 cellspacing=0>
<%
End Sub
Sub TeamFoot( team, id, forumid )
forum = "http://forum.theredzone.org/viewforum.php?f="& forumid
%>
<tr>
<td colspan=2 height=20 valign="bottom" align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<a href= "http://ticketsolutions.com/nfl-<%=team%>-tickets.asp" rel="nofollow"><strong>Looking
For <%=team%>' Tickets? Click Here</strong></a></font> </td>
</tr>
<tr>
<td colspan=2 height=15 valign="bottom" align="center"> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<a href= "http://www.theredzone.org/archives/showteam.asp?Team=<%=team%>">
Miss a story? Look for it in our <%=team%>' News Archives</a> </font>
</td>
</tr>
<tr>
<td colspan=2 height=20 valign="top" align="center"> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<a href="<%=forum%>"> Talk about it in the <%=team%>' Forum</a> </font>
</td>
</tr>
</table></td>
</tr>
<%
End Sub
Sub Story( link, hl, pdt )
%>
<tr>
<td valign="Top" width="30" align="left"> <font face="verdana" size="2"><img src="http://theredzone.org/images/fbsmall.gif" width="15" height="15"></font>
</td>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<a href="<%=link%>"> <%=hl%></a> </font> <font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="blue"><%=pdt%></font>
</td>
</tr>
<%
End Sub
' ************************************************************************
' Now begin output of the actual table:
' ************************************************************************
%>
<table width=840 border=0 cellpadding=0 cellspacing=2>
<tr>
<!-- entire two team columns all in this one outer row -->
<%
priorTeam = ""
priorConf = ""
priorTeamId = 0
priorForumId = 0
Do Until rsTemp.EOF
curTeam = rsTemp("ShortTeamName")
If curTeam <> priorTeam Then
If priorTeam <> "" Then TeamFoot priorTeam, priorTeamId, priorForumId
' changed teams...did we also change conference?
curConf = UCase( Left( rsTemp("Category"), 3 ) ) ' should be NFC or AFC??
If curConf <> priorConf Then
' changed conference...start new column
If priorConf <> "" Then ColumnFoot
ColumnHead curConf
priorConf = curConf
End If
' and then show new team
TeamHead rsTemp("TeamColor"), rsTemp("TeamFont"), curTeam
' we need to remember these three things ...
' ... in order to be able to create the TeamFoot
priorTeam = curTeam
priorTeamId = rsTemp("teamId")
priorForumId = rsTemp("forumId")
End If
' and finally we can output one "story" per "line"
Story rstemp("Link"), rstemp("Headline"), rstemp("PDate")
rstemp.MoveNext
Loop
TeamFoot priorTeam, priorTeamId, priorForumId
ColumnFoot
%>
</tr>
</table>
<td align="left" valign="top">
</center>
</td>
</tr>
</table>
</body>
</html>
Out put of this page is
http://theredzone.org/ (NFC and AFC list)