473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
-----------------------------------------------------------------------

Jul 19 '05 #1
1 1918
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" <Ke**********@mail.codecomments.com> wrote in message
news:Ke**********@mail.codecomments.com...

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
------------------------------------------------------------------------

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bruce W...1 | last post by:
In my effort to learn PHP I'm playing with some simple email scripts. They worked a few days ago but they stopped working. The only thing I've done to this Windows 2000 PC in this time was a...
21
by: BlackHawke | last post by:
My name is Nick Soutter, I own a small game development company (www.aepoxgames.net) making our first game (www.andromedaonline.net) in java. I am writing because we are having a very...
11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
3
by: Christopher M. Lusardi | last post by:
Hello, THE PROBLEM ----------- If I compile parts of my program with CC, and C, using extern "C" as appropriate it compiles without any errors, but it does a segmentation fault when I run the...
13
by: John | last post by:
Hi all: In my code I define a class with inline constructor. But it does not work. I describe the class as below: myclass{ public: myclass(int a, int b) { r1 = a; r2 = b;} protected:
18
by: bArT | last post by:
Hi! I have a problem with such situation. I have a class like below and have some pointers (ptr1 and ptr2). I dynamically allocate memory in constructor and I free in destructor. For one pointer...
9
by: babak | last post by:
Hi everybody I'm working with a project in embedded Visual Studio 4 and I have a general problem which I hope that somebody can help me with. My problem is the following: My project works fine in...
14
by: Harry | last post by:
Good Day, Here is a structure that i am using in my code typedef struct storable_picture { PictureStructure structure; int poc;
8
by: Rinaldo | last post by:
Hi, When I start my program in the debugger, there is no problem, but when not I get an exception. It appears in: private void Upload(string filename, string FTnaam) { MessageBox.Show("in...
6
by: pkchandra999 | last post by:
My Server OS : Centos 64 bit Apache version is Apache v2.2.9 Php Version : 5.2.5 I am providing feeds to my forum through RSS. The feeds are in html and those feeds will be parsed to bbcode...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.