Hi Everyone,
I have a store procedure returning 7 rows for 3 columns, basically I am retrieving:
Descriptor Lower Range Upper Range
D1 1 10
D2 2 11
D3 3 12
D4 4 13
D5 5 14
D6 6 15
D7 7 16
Now on my ASP page there are Text values that can be entered for Descriptors D1 - D7 and I need to validate the form to ensure that all values for each descriptor mentioned are within the lower and upper range for that descriptor in the look up table.
For example: If I have a user entering value of D4 from the form, than I have to find out if it is between 4-13, if not send them a pop up to say, please enter within that range.
Solution I thought:
Get the record set into array in the ASP page and than for each descriptor validate the form value entered is within the range.
Problem: Is that I can not get my ASP page to return value more than [3,2] :(
My Code in the ASP page is:
[ASP]
<%
Dim ValConn, ValCmd, ValRS, ValParam, ValArray, Region, temp
Dim intLastCol, intLastRow, intRow, intCol
temp = "T"
SET ValConn = Server.CreateOb ject("ADODB.Con nection")
SET ValCmd = Server.CreateOb ject("ADODB.Com mand")
SET ValRS = Server.CreateOb ject("ADODB.Rec ordset")
Set ValParam=Server .CreateObject(" ADODB.Parameter ")
ValConn.Open Application("Co nnection")
SET ValCmd.ActiveCo nnection = ValConn
ValCmd.CommandT ype = 4
ValCmd.CommandT ext = "sp_Validate_Ra nge_Values"
Set ValParam = ValCmd.CreatePa rameter("Region ", 200,1,1,temp)
ValCmd.Paramete rs.Append ValParam
SET ValRS = ValCmd.Execute
ValArray = ValRS.GetRows
ValRS.Close
SET ValRS= Nothing
'intLastCol = UBound(ValArray , 1)
'intLastRow = Ubound(ValArray , 2)
'For intRow = 0 to intLastCol
'For intCol = 0 to intLastRow
'Response.Write ValArray(intCol , intRow) & " "
'Next
'Response.Write "<Br>"
'Next
Response.Write ValArray (0,0,)
Response.Write "<Br>"
Response.Write ValArray (0,1)
Response.Write "<Br>"
Response.Write ValArray (0,2)
Response.Write "<Br>"
Response.Write ValArray (1,0)
Response.Write "<Br>"
Response.Write ValArray (1,1)
Response.Write "<Br>"
Response.Write ValArray (1,2)
Response.Write "<Br>"
Response.Write ValArray (2,0)
Response.Write "<Br>"
Response.Write ValArray (2,1)
Response.Write "<Br>"
Response.Write ValArray (2,2)
Response.Write "<Br>"
Response.Write ValArray (3,0)
Response.Write "<Br>"
Response.Write ValArray (3,1)
Response.Write "<Br>"
Response.Write ValArray (3,2)
Response.Write "<Br>"
Response.Write ValArray (4,0)
Response.Write "<Br>"
Response.Write ValArray (4,1)
Response.Write "<Br>"
Response.Write ValArray (4,2)
Response.Write "<Br>"
Response.Write ValArray (5,0)
Response.Write "<Br>"
Response.Write ValArray (5,1)
Response.Write "<Br>"
Response.Write ValArray (5,2)
Response.Write "<Br>"
ValConn.Close
SET ValConn = Nothing
Response.Write( "Hello")
%>
[/ASP]
ERROR MESSAGE ON ASP PAGE IS:
D1
D2
D3
1
2
3
10
11
13
Microsoft VBScript runtime error '800a0009'
Subscript out of range: '[number: 3]'
/scidc/test.asp, line 74
I believe the issue is because ASP is making an 2D array whereas I need a 3D array and I tired finding how to get multi dimensional array in ASP but none of them were useful, would be glad if someone can explain what is wrong and what can be a possible solution to make the code work.
Thanks in advance,
Sree
I have a store procedure returning 7 rows for 3 columns, basically I am retrieving:
Descriptor Lower Range Upper Range
D1 1 10
D2 2 11
D3 3 12
D4 4 13
D5 5 14
D6 6 15
D7 7 16
Now on my ASP page there are Text values that can be entered for Descriptors D1 - D7 and I need to validate the form to ensure that all values for each descriptor mentioned are within the lower and upper range for that descriptor in the look up table.
For example: If I have a user entering value of D4 from the form, than I have to find out if it is between 4-13, if not send them a pop up to say, please enter within that range.
Solution I thought:
Get the record set into array in the ASP page and than for each descriptor validate the form value entered is within the range.
Problem: Is that I can not get my ASP page to return value more than [3,2] :(
My Code in the ASP page is:
[ASP]
<%
Dim ValConn, ValCmd, ValRS, ValParam, ValArray, Region, temp
Dim intLastCol, intLastRow, intRow, intCol
temp = "T"
SET ValConn = Server.CreateOb ject("ADODB.Con nection")
SET ValCmd = Server.CreateOb ject("ADODB.Com mand")
SET ValRS = Server.CreateOb ject("ADODB.Rec ordset")
Set ValParam=Server .CreateObject(" ADODB.Parameter ")
ValConn.Open Application("Co nnection")
SET ValCmd.ActiveCo nnection = ValConn
ValCmd.CommandT ype = 4
ValCmd.CommandT ext = "sp_Validate_Ra nge_Values"
Set ValParam = ValCmd.CreatePa rameter("Region ", 200,1,1,temp)
ValCmd.Paramete rs.Append ValParam
SET ValRS = ValCmd.Execute
ValArray = ValRS.GetRows
ValRS.Close
SET ValRS= Nothing
'intLastCol = UBound(ValArray , 1)
'intLastRow = Ubound(ValArray , 2)
'For intRow = 0 to intLastCol
'For intCol = 0 to intLastRow
'Response.Write ValArray(intCol , intRow) & " "
'Next
'Response.Write "<Br>"
'Next
Response.Write ValArray (0,0,)
Response.Write "<Br>"
Response.Write ValArray (0,1)
Response.Write "<Br>"
Response.Write ValArray (0,2)
Response.Write "<Br>"
Response.Write ValArray (1,0)
Response.Write "<Br>"
Response.Write ValArray (1,1)
Response.Write "<Br>"
Response.Write ValArray (1,2)
Response.Write "<Br>"
Response.Write ValArray (2,0)
Response.Write "<Br>"
Response.Write ValArray (2,1)
Response.Write "<Br>"
Response.Write ValArray (2,2)
Response.Write "<Br>"
Response.Write ValArray (3,0)
Response.Write "<Br>"
Response.Write ValArray (3,1)
Response.Write "<Br>"
Response.Write ValArray (3,2)
Response.Write "<Br>"
Response.Write ValArray (4,0)
Response.Write "<Br>"
Response.Write ValArray (4,1)
Response.Write "<Br>"
Response.Write ValArray (4,2)
Response.Write "<Br>"
Response.Write ValArray (5,0)
Response.Write "<Br>"
Response.Write ValArray (5,1)
Response.Write "<Br>"
Response.Write ValArray (5,2)
Response.Write "<Br>"
ValConn.Close
SET ValConn = Nothing
Response.Write( "Hello")
%>
[/ASP]
ERROR MESSAGE ON ASP PAGE IS:
D1
D2
D3
1
2
3
10
11
13
Microsoft VBScript runtime error '800a0009'
Subscript out of range: '[number: 3]'
/scidc/test.asp, line 74
I believe the issue is because ASP is making an 2D array whereas I need a 3D array and I tired finding how to get multi dimensional array in ASP but none of them were useful, would be glad if someone can explain what is wrong and what can be a possible solution to make the code work.
Thanks in advance,
Sree
Comment