Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 02:17 PM
Kewlb
Guest
 
Posts: n/a
Default Problem with this code....


Hey Guys,

My server decided to all of a sudden stop giving me compile/scrip
errors and instead now just gives me a blank page with no informatio
as to what the problem might be. I have looked over the below cod
quite a few times and just for the life of me can not figure out wha
could be wrong maybe a fresh set of eyes could help me. Thanks i
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_Pai
& " 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_Collecte
& " 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 o
the team." & ".<br>"
response.write RHTML

end i


-
Kewl
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

  #2  
Old July 19th, 2005, 02:17 PM
Aaron [SQL Server MVP]
Guest
 
Posts: n/a
Default Re: Problem with this code....

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]


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles