Guest_imported
New member
- Jan 1, 1970
- 0
I keep having a problem with the line:
total_years = total_years + (old_year - old_rookie)
The line has astericks above and below the line.
I substituted in total = total + (1972 - 1958) and it worked.
Ideas?
Thanks,
Chris
<%
mycount = 1
%>
<table border="1">
<%
'do while not testRS.EOF
strSQL2 = "select b.player_id as PID, p.rookie_year as RY, b.year as Y, b.homeruns as H from batting b, player p " & _
" where p.rookie_year < 1997 and b.player_id = p.player_id and b.homeruns > 0 " & _
" order by b.player_id asc, b.year asc "
'connect to the database to fetch data
old_player_id = "zz"
total_years = 0
total_players = 0
old_homeruns = 0
old_year = 0
old_rookie = 0
current_hr = 0
current_rookie = 0
current_year = 0
dim diff
Dim oConn2
Set oConn2 = Server.CreateObject("ADODB.Connection"
oConn2.open "DSN=***;UID=****;PWD=***"
set testRS2 = oConn2.execute(strSQL2)
do while not testRS2.EOF
for each oField in testRS2.Fields
current_hr = "'" & testRS2("H"
& "'"
current_rookie = "'" & testRS2("RY"
& "'"
current_year = "'" & testRS2("Y"
& "'"
if "'" & testRS2("PID"
& "'" <> old_player_id then
old_player_id = "'" & testRS2("PID"
& "'"
'''''''''''''''''''''''''''''''''''''''''''''''''''
total_years = total_years + (old_year - old_rookie)
'''''''''''''''''''''''''''''''''''''''''''''''''''
total_players = total_players + 1
old_homeruns = current_hr
old_year = current_year
old_rookie = current_rookie
else
if (current_hr > old_homeruns) then
old_homeruns = current_hr
old_year = current_year
old_rookie = current_rookie
end if
end if
next
testRS2.MoveNext
loop%>
<tr>
<td>Number of years: </td>
<td><%Response.Write(round((total_years / total_players) * 100)/100)%></td>
</tr>
<%
oConn2.Close
Set oConn2 = Nothing
set testRS2 = Nothing
%>
</table>
total_years = total_years + (old_year - old_rookie)
The line has astericks above and below the line.
I substituted in total = total + (1972 - 1958) and it worked.
Ideas?
Thanks,
Chris
<%
mycount = 1
%>
<table border="1">
<%
'do while not testRS.EOF
strSQL2 = "select b.player_id as PID, p.rookie_year as RY, b.year as Y, b.homeruns as H from batting b, player p " & _
" where p.rookie_year < 1997 and b.player_id = p.player_id and b.homeruns > 0 " & _
" order by b.player_id asc, b.year asc "
'connect to the database to fetch data
old_player_id = "zz"
total_years = 0
total_players = 0
old_homeruns = 0
old_year = 0
old_rookie = 0
current_hr = 0
current_rookie = 0
current_year = 0
dim diff
Dim oConn2
Set oConn2 = Server.CreateObject("ADODB.Connection"
oConn2.open "DSN=***;UID=****;PWD=***"
set testRS2 = oConn2.execute(strSQL2)
do while not testRS2.EOF
for each oField in testRS2.Fields
current_hr = "'" & testRS2("H"
current_rookie = "'" & testRS2("RY"
current_year = "'" & testRS2("Y"
if "'" & testRS2("PID"
old_player_id = "'" & testRS2("PID"
'''''''''''''''''''''''''''''''''''''''''''''''''''
total_years = total_years + (old_year - old_rookie)
'''''''''''''''''''''''''''''''''''''''''''''''''''
total_players = total_players + 1
old_homeruns = current_hr
old_year = current_year
old_rookie = current_rookie
else
if (current_hr > old_homeruns) then
old_homeruns = current_hr
old_year = current_year
old_rookie = current_rookie
end if
end if
next
testRS2.MoveNext
loop%>
<tr>
<td>Number of years: </td>
<td><%Response.Write(round((total_years / total_players) * 100)/100)%></td>
</tr>
<%
oConn2.Close
Set oConn2 = Nothing
set testRS2 = Nothing
%>
</table>