We could probably improve the efficiency of this code, mmm, 100 times. For
one, you loop through the same recordset twice, not sure why that is. And
also, the database can figure out all of your calculations using aggregate
queries, instead of you manually stopping inside a loop to perform
conditional math.
Could you give us more information, e.g. what database, what is the database
structure (CREATE TABLE ...), some sample data, and desired results?
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Kewlb" <Kewlb.19nshn@mail.codecomments.com> wrote in message
news:Kewlb.19nshn@mail.codecomments.com...[color=blue]
>
> Hey Guys,
>
> My server decided to all of a sudden stop giving me compile/script
> errors and instead now just gives me a blank page with no information
> as to what the problem might be. I have looked over the below code
> quite a few times and just for the life of me can not figure out what
> could be wrong maybe a fresh set of eyes could help me. Thanks in
> advance! (sorry for the sloppy code as well)
>
>
> Set adoCon = Server.CreateObject("ADODB.Connection")
> 'Set the connection string to the database
> adoCon.connectionstring = strCon
> 'Set an active connection to the Connection object
> adoCon.Open
> SQLString = "Select * from TblTournaments where Member = '" &
> request("member") & "'"
> Set adoRec = Server.CreateObject("ADODB.Recordset")
> adoRec.open SQLString, adoCon, 3, 3
> if adoRec.EOF = true then
> RHTML = "This report did not generate any data."
> end if
> if adoRec.EOF = false then
>
> adoRec.movefirst
> xyz = 0
> do until adoRec.EOF = true
> tmpTournament(xyz) = adoRec("TNUM")
> xyz = xyz + 1
> adoRec.movenext
> loop
> adoRec.close
>
> for x = lbound(tmpTournament) to ubound(tmpTournament)
> SQLString = "Select * from tblTournaments where TNUM = " &
> tmpTournament(x)
> adoRec.open SQLString, adoCon, 3, 3
> for y = 1 to adoRec.recordcount
> if adoRec("Member") = request.form("member") then
> Total_Buyin = Total_Buyin + adoRec("buyin")
> Tournaments_Played = Tournaments_Played + 1
> if adoRec("won") > 0 then
> Gross_Money_Won = Gross_Money_Won + adoRec("won")
> Net_Money_Won = Net_Money_Won + (adoRec("won") /
> adoRec.recordcount)
> Money_Paid = Money_Paid + (adoRec("won") -
> Net_Money_Won)
> end if
> else
> if adoRec("won") > 0 then
> Gross_Money_Collected = Gross_Money_Collected +
> (adoRec("won") / adoRec.recordcount)
> end if
> end if
> next
> adoRec.close
> Total_Tournaments = Total_Tournaments + 1
> next
>
> Total_Net_Collected = (Net_Money_Won + Gross_Money_Collected)
> - Total_Buyin
> Solo_Collected = Gross_Money_Won - Total_Buyin
>
> RHTML = RHTML & "You have played in a total of " &
> Tournaments_Played & " tournaments.<br>"
> RHTML = RHTML & "You have spent a total of $" & Total_Buyin &
> " in entry fees.<br>"
> RHTML = RHTML & "You have generated a Gross amount of $" &
> Gross_Money_Won & " from your wins.<br>"
> RHTML = RHTML & "You have paid out a total of $" & Money_Paid
> & " to other members.<br>"
> RHTML = RHTML & "You have generated a net amount of $" &
> Net_Money_Won & " after paying all members.<br>"
> RHTML = RHTML & "You have collected $" & Gross_Money_Collected
> & " from other members.<br>"
> RHTML = RHTML & "You have made a net amount $" &
> Total_Net_Collected & ".<br>"
> RHTML = RHTML & "Flying solo you would have made $" &
> Solo_Collected & " compared to $" & Total_Net_Collected & " being on
> the team." & ".<br>"
> response.write RHTML
>
> end if
>
>
>
> --
> Kewlb
> ------------------------------------------------------------------------
> Posted via
http://www.codecomments.com
> ------------------------------------------------------------------------
>[/color]