Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - SQL HELP - SELECT STATEMENT
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SQL HELP - SELECT STATEMENT

 Post Reply Post Reply Page  <12345>
Author
Mikeap View Drop Down
Newbie
Newbie


Joined: 12 March 2003
Location: United States
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mikeap Quote  Post ReplyReply Direct Link To This Post Posted: 24 August 2003 at 9:19pm

Array Dimensions: 4 x 0

Back to Top
Mikeap View Drop Down
Newbie
Newbie


Joined: 12 March 2003
Location: United States
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mikeap Quote  Post ReplyReply Direct Link To This Post Posted: 24 August 2003 at 9:22pm

Here is the full recordset code and the GetRow.

<%
Dim rsround1__MMColParam
rsround1__MMColParam = "1"
If (Request("MM_EmptyValue") <> "") Then
  rsround1__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim rsround1__MMColParam2
rsround1__MMColParam2 = "1"
If (Request.QueryString("tournid") <> "") Then
  rsround1__MMColParam2 = Request.QueryString("tournid")
End If
%>

<%
Dim rsround1
Dim rsround1_numRows

Dim arrRound1

Set rsround1 = Server.CreateObject("ADODB.Recordset")
rsround1.ActiveConnection = MM_db_data_conn_STRING
rsround1.Source = "SELECT TOP 16 *  FROM TBL_TOURNAMENTBRACKETS  WHERE bracketposition = " + Replace(rsround1__MMColParam, "'", "''") + " AND tournid = " + Replace(rsround1__MMColParam2, "'", "''") + "  ORDER BY tournbracketsid ASC"
rsround1.CursorType = 0
rsround1.CursorLocation = 2
rsround1.LockType = 1
rsround1.Open()

rsround1_numRows = 0

arrRound1 = rsround1.GetRows
%>



Edited by Mikeap
Back to Top
b_bonnett View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Location: New Zealand
Status: Offline
Points: 275
Post Options Post Options   Thanks (0) Thanks(0)   Quote b_bonnett Quote  Post ReplyReply Direct Link To This Post Posted: 24 August 2003 at 9:23pm

That means the entry in the array you are trying to reference does not exist. The columns go from 0 to 4 (i.e. five entries) and there is one row (0). So you can't reference the (non-existent) second row, which is what you are trying to do, hence the error.

Blair

Webmaster, The Plane Gallery
Greetings From Christchurch
Back to Top
Mikeap View Drop Down
Newbie
Newbie


Joined: 12 March 2003
Location: United States
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mikeap Quote  Post ReplyReply Direct Link To This Post Posted: 24 August 2003 at 9:24pm

Exactly - I know and understand this ... I want to say if the second-sixteen does not exist, display this instead.

How?

Back to Top
b_bonnett View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Location: New Zealand
Status: Offline
Points: 275
Post Options Post Options   Thanks (0) Thanks(0)   Quote b_bonnett Quote  Post ReplyReply Direct Link To This Post Posted: 24 August 2003 at 9:31pm

Try using the following:

If UBound(arrRound1, 2) > 0 Then
     ...Display Stuff From Array...
Else
     ...Message Saying Whatever...
End If

Basically, if there are two rows, then UBound(arrRound1, 2) will equal one - I've used > 0 so that it will also display if there are more than 2. If there is only one row, then your message saying "No data in the second row", or whatever the message is, will be displayed.

Blair

Webmaster, The Plane Gallery
Greetings From Christchurch
Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 24 August 2003 at 9:41pm
Use Ubound(arrRound1,2) to determine if the row is available. If Ubound(arrRound1,2) is less than the row you are seeking then you do not have values to display in the row. Remember that the even Ubound begins counting at 0 so an array with one row will have an Upper Bound (UBound) equal to zero (0) not one (1). An array will no rows should produce an error with Ubound, I believe.
Back to Top
Mikeap View Drop Down
Newbie
Newbie


Joined: 12 March 2003
Location: United States
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mikeap Quote  Post ReplyReply Direct Link To This Post Posted: 24 August 2003 at 9:42pm

hmm - how do i incorporate this for 16 rows?

if you look at the link on the first page, each gray line will have response.write(arrRound(3,0))  (0-15)

see what im saying?

Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 24 August 2003 at 10:03pm
I'm assuming that you have 5 recordsets (one for each round) and each record set should have half the number of records as the previous so use a For loop and mod

For i = 0 to Ubound(arrRound1,0)
Response.Write arrRound1(0,i)
if i mod 2 = 0 then
    Response.Write arrRound2(0,CLng(i/2))
end if
if i mod 4 = 0 then
    Response.Write arrRound3(0,CLng(i/4))
end if
if i mod 8 = 0 then
    Response.Write arrRound4(0,CLng(i/8))
end if
if i mod 16 = 0 then
    Response.Write arrRound5(0,CLng(i/16))
end if
Next
Back to Top
 Post Reply Post Reply Page  <12345>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.