I'm in the process of migrating my SQL databases to a new server - all the code I've written works fine, but I'm stuck on this piece that someone who is no longer here wrote. Its taking the entries in a sports news database and displaying it on a page:
Unfortunately, for some reason its only displaying the date currently and I can't figure out why. I'm guessing its something to do with the array, but need some help figuring out where. Here's the code:
Thanks in advance!
Michelle
Unfortunately, for some reason its only displaying the date currently and I can't figure out why. I'm guessing its something to do with the array, but need some help figuring out where. Here's the code:
Code:
<%
Dim objDBConnection, objRecordset, strImgSrc, blnError, strErrorOutput
Dim SQL_academics_Calendar, strCalendarArray
Dim intRow
Dim mon,dy,yr
mon = Month(NOW)
dy = DAY(NOW)
yr = YEAR(NOW)
blnError = false
SQL_academics_Calendar="Select id, code, postdate, title, story from sports_releases where code='sp' order by postdate desc"
If Not ( GetADO( objDBConnection ) And GetRecordSet( objRecordset ) ) Then
blnError = True
strErrorOutput = ERROR_DATA_OBJECTS
End If
If Not blnError Then
objDBConnection.Open db_strConn
If Err.Number Then
If Not HaveError() Then SetError "academics_Calendar'", Err.number, Err.Description
blnError = True
strErrorOutput = ERROR_DB_CONNECT
End If
End If
If Not blnError Then
objRecordset.Open SQL_academics_Calendar, objDBConnection
If Err.Number Then
If Not HaveError() Then SetError "academics_Calendar'", Err.number, Err.Description
blnError = True
strErrorOutput = ERROR_DB_QUERY
End If
End If
If Not blnError Then
If Not objRecordset.EOF Then
strCalendarArray = objRecordset.GetRows
Const LOCAL_CALENDAR_POSTDATE = 2
Const LOCAL_CALENDAR_TITLE = 3
Const LOCAL_CALENDAR_STORY = 4
Else
blnError = True
strErrorOutput = ERROR_DB_QUERY
End If
If Err.Number Then
If Not HaveError() Then SetError "StudentLife_Calendar'", Err.number, Err.Description
blnError = True
strErrorOutput = ERROR_DB_QUERY
End If
End If
If Not blnError Then
objRecordset.Close
objDBConnection.Close
Set objRecordset = Nothing
Set objDBConnection = Nothing
End If
%>
<table width="100%">
<%
if not blnError then
Dim cCode, cHeading, lastCode
lastCode = "sp"
Response.write "<h1> Dolphin Sports News </h1>"
For intRow = 0 To UBound(strCalendarArray, 2)
cCode = Trim(strCalendarArray(1,intRow))
if Trim(cCode) = "sp" then
cHeading = "<h3> Current Headlines </h3>"
end if
if lastCode <> cCode then
response.write "<tr><td align=left><p>" & cHeading & "</p></td>"
response.write "<td> </td></tr>"
end if
%>
<tr>
<td width=100 valign=top>
<div align=right>
<p class=pressbody><% response.write Trim( strCalendarArray(LOCAL_CALENDAR_POSTDATE, intRow)) %>
</p>
</div>
</td>
<td width=475 valign=top>
<p class=pressbody><a href="Athletic_story.asp?id=<% = CInt( strCalendarArray(0, intRow) ) %>">
<% = Trim( strCalendarArray(LOCAL_CALENDAR_TITLE, intRow) ) %></a>
</p>
</td>
</tr>
<%
Next
else
response.write "<tr> <td> No Athletic News </td><td></td></tr>"
end if
%>
Thanks in advance!
Michelle