Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 16th, 2006, 02:59 PM
DangerMouse DangerMouse is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 9 DangerMouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 12 m 19 sec
Reputation Power: 0
Help

Here is my code
[code]
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/conFootball.asp" -->
<%
Dim rsOrganiser__MMColParam
rsOrganiser__MMColParam = "0"
If (Request.Form("rbgame") <> "") Then
rsOrganiser__MMColParam = Request.Form("rbgame")
End If
%>

<%
Dim rsOrganiser
Dim rsOrganiser_numRows

Set rsOrganiser = Server.CreateObject("ADODB.Recordset")
rsOrganiser.ActiveConnection = MM_conFootball_STRING
rsOrganiser.Source = "Select * from details as A where A.uin in (select organiser from game as B where B.UIN = " + Replace(rsOrganiser__MMColParam, "'", "''") + ")"
rsOrganiser.CursorType = 0
rsOrganiser.CursorLocation = 2
rsOrganiser.LockType = 1
rsOrganiser.Open()

rsOrganiser_numRows = 0
%>
<%
Dim rsGetRows
Dim rsGetRows_numRows

Set rsGetRows = Server.CreateObject("ADODB.Recordset")
rsGetRows.ActiveConnection = MM_conFootball_STRING
rsGetRows.Source = "SELECT game.uin, details.forename, details.surname, details.uin, game.date, game.organiser, details.[NT Login] FROM game INNER JOIN (details INNER JOIN teams ON details.uin = teams.player) ON game.uin = teams.game ORDER BY game.uin;"
rsGetRows.CursorType = 0
rsGetRows.CursorLocation = 2
rsGetRows.LockType = 1
rsGetRows.Open()

rsGetRows_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsGetRows_numRows = rsGetRows_numRows + Repeat1__numRows
%>
<%
Dim playerCount

'DEBUG: playerCount value will be set by count of records in the recordset
'Ive just set it to 10 for the moment
playerCount=10

Dim arrPlayer
ReDim arrPlayer(playerCount-1)

'Grab players firstname and surname from the recordset, to populate the arrPlayer array
'For now Ive just created 10

arrPlayer(0)="player1"
arrPlayer(1)="player2"
arrPlayer(2)="player3"
arrPlayer(3)="player4"
arrPlayer(4)="player5"
arrPlayer(5)="player6"
arrPlayer(6)="player7"
arrPlayer(7)="player8"
arrPlayer(8)="player9"
arrPlayer(9)="player10"

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Team Listing Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="scripts/Style1a.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="740" border="1" align="center">
<tr>
<td height="20" colspan="5"><!--#include file="Head.asp" --></td>
</tr>
<tr>
<td width="150">&nbsp;</td>
<td width="10">&nbsp;</td>
<td width="400">
<form method="get" name="frmRandom" id="frmRandom">
<br>

<%
While ((Repeat1__numRows <> 0) AND (NOT rsGetRows.EOF))
%>
<%=(rsGetRows.Fields.Item("forename").Value)%> <%=(rsGetRows.Fields.Item("surname").Value)%><br>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsGetRows.MoveNext()
Wend
%><br>
<br>
<%
Dim iLoop
Response.Write "<strong>Players signed up for this game:</strong><br>"
For iLoop = LBound(arrPlayer) to UBound(arrPlayer)
Response.Write arrPlayer(iLoop) & "<BR>"
Next
Response.Write "<br>"

Function Jumble(ByVal aArray)

Dim iUpper, iLower, iLoop, iSwapPos, varTmp
iUpper = UBound(aArray)
iLower = LBound(aArray)

Randomize Timer
For iLoop = iLower to iUpper
iSwapPos = Int(Rnd * (iUpper + 1))

varTmp = aArray(iLoop)
aArray(iLoop) = aArray(iSwapPos)
aArray(iSwapPos) = varTmp

Next

Jumble = aArray
End Function

Dim arrNumbers
ReDim arrNumbers(playerCount-1)

For i=0 to playerCount-1
arrNumbers(i)=i+1
Next

'DEBUG: Display the array in-order

'For iLoop = LBound(arrNumbers) to UBound(arrNumbers)
'Response.Write arrNumbers(iLoop) & "...<BR>"
'Next

'response.write "<P>"

'DEBUG: Jumble array and display the new order
arrNumbers = Jumble(arrNumbers)
arrNumbers = Jumble(arrNumbers)

Response.Write "<strong>Reorder....</strong><br>"
For iLoop = LBound(arrNumbers) to UBound(arrNumbers)
Response.Write arrNumbers(iLoop) & "<BR>"
Next
Response.Write "<br>"

Response.Write "<strong>Which corresponds to....</strong><br>"
For iLoop = LBound(arrNumbers) to UBound(arrNumbers)
arrNumbers(iLoop) = arrPlayer(arrNumbers(iLoop) - 1)
Response.Write arrNumbers(iLoop) & "<br>"
Next

%>
<input type="submit" name="Randomize" value="Randomize Teams" onClick="Jumble">
</form></td>
<td width="10">&nbsp;</td>
<td width="170">&nbsp;</td>
</tr>
</table>
</body>
</html>
<%
rsOrganiser.Close()
Set rsOrganiser = Nothing
%>
<%
rsGetRows.Close()
Set rsGetRows = Nothing
%>
[code]
I need help with my players array I don't know how to retrieve them from my database as well as the player count for each game set up.

Could anyone provide assistance

Reply With Quote
  #2  
Old October 16th, 2006, 03:12 PM
ProEdge's Avatar
ProEdge ProEdge is offline
Contributing User
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jan 2004
Location: Somewhere I belong
Posts: 1,565 ProEdge User rank is Sergeant Major (2000 - 5000 Reputation Level)ProEdge User rank is Sergeant Major (2000 - 5000 Reputation Level)ProEdge User rank is Sergeant Major (2000 - 5000 Reputation Level)ProEdge User rank is Sergeant Major (2000 - 5000 Reputation Level)ProEdge User rank is Sergeant Major (2000 - 5000 Reputation Level)ProEdge User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 17 h 7 m 15 sec
Reputation Power: 39
You should have posted this in the ASP section.
__________________
Keep it Prodigy, Keep it Real

Reply With Quote
  #3  
Old October 16th, 2006, 03:26 PM
DangerMouse DangerMouse is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 9 DangerMouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 12 m 19 sec
Reputation Power: 0
Sorry posted there now.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT