Hey all.
Could someone tell me how I would implement something like the below in
ASP.NET?
Basically it outputs data into a preformatted html table. As far as I
can see I need to use datagrid ordatalist in .NET to get this data, then
a template. Is that the only (read: easiest) way??
<%
sqlstr = "SELECT TOP " & numItems & " * FROM news ORDER BY date DESC,
time DESC"
Set rsnews = news.Execute(sqlstr)
If Err.Number <> 0 Then
response.write "Couldn't exec SQL query"
response.end
End If
If rsnews.EOF Then
response.write "No records found... DB corrupt?"
response.end
End If
Function to_html(s_string)
to_html = Replace(s_string, vbcrlf, "<br>")
to_html = Replace(to_html, """", """)
End Function
rsnews.moveFirst
Dim db
While Not rsnews.EOF
s_message=rsnews.fields("news")
s_message2=to_html(s_message)
s_message3=to_html(s_message)
If rsnews.fields("urls") = "1" THEN
s_message3 = edit_hrefs(s_message2)
End if
currdate = FormatDateTime(rsnews.fields("date"), 1)
if db <> currdate then
%>
<br>
</p>
<div align="center">
<table cellspacing="0" width="475" cellpadding="2"
bgcolor="<%=textcolour%>">
<tr>
<td align="left" height="28"><strong>
<font color="<%=backgroundcolour%>" size="-1"
face="<%=fontface%>">
<%
on error resume next
test = weekday(currdate)
if err.number <> 0 then
response.write currdate
else
response.write weekdayname(weekday(rsnews.fields("date"))) & ", " &
currdate
err.number = 0
end if
%> </font></strong></td>
</tr>
</table>
<%
db = currdate
end if
%> <br>
<table width="475" cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="left" width="466">
<div align="left"><font face="<%=fontface%>" size="2">
<strong><%=rsnews.fields("title")%></strong>
</font></div>
</td>
<td align="right" width="84"><font size="-2"><font
face="<%=fontface%>"></font></font></td>
</table>
</div>
<div align="center">
<table width="475" border="0">
<tr>
<td> <font size="-1" face="<%=fontface%>"><%Response.Write
s_message3%>
</font> </td>
</tr>
</table>
<br>
<%
rsnews.moveNext
Wend
%>