Hi Dan,
thanks once again for your qualified advice. Actually I did try to
use the GetRow method and it seems to work in retrieving the values i
am looking for. But, sadly, I've got problems while I am trying to
use them on a formula.
To make it easier I will rite down the code:
<%@ LANGUAGE="VBSCRIPT" %>
<%
Dim outpostDB
Dim outpostDBPath
stroutpostDBPath = Server.MapPath("../GestAlt/alternative.mdb")
%>
<%
set outpostDB = Server.CreateObject("ADODB.Connection")
outpostDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
stroutpostDBPath & ";"
%>
<%
set val = outpostDB.Execute("Select valore_quota from valori where id
= 1 and data_quota = #31/12/2004# ")
If Not val.EOF then
arrvaloriSet = val.GetRows()
End If
%>
<%
val.Close
set val = Nothing
%>
<%
set val2 = outpostDB.Execute("Select valore_quota from valori where
id = 1 and data_quota = #30/09/2005# ")
If Not val2.EOF then
arrvalori2Set = val2.GetRows()
End If
%>
<%
val2.Close
set val2 = Nothing
%>
<%
outpostDB.Close
set outpostDB = Nothing
%>
<%
iRowNumber = ubound(arrvaloriSet,2)
For iCounter= 0 to iRowNumber
' this works fine and return me the value
Response.Write(" "& arrvaloriSet(0,iCounter) & " ")
Next
%>
<%
iRowNumber2 = ubound(arrvalori2Set,2)
For iCounter2= 0 to iRowNumber2
' this works fine and return me the value
Response.Write(""& arrvalori2Set(0,iCounter2) & " ")
Next
%>
'this is returning me an error Microsoft VBScript (0x800A0009)
Subscript out of range: '[number: 1]'
<% Response.Write("("& arrvaloriSet(0,iCounter) & "/"& arrvalori2Set
(0,iCounter2) & ")") %>
Rgds
Valter
--- In [email protected], "Dan Powderhill"
<[EMAIL PROTECTED]> wrote:
>
> I'm guessing the error is being caused by the fact that you don't
appear
> to be dimensioning the variable "x" as an array anywhere, so it
doesn't
> know that x is an array or whether i is a valid subscript of the
array
> etc etc
>
> However, rather than looping through your recordset and manually
> assigning the values to an array I would look at the GetRows()
method of
> the recordset as it can do what you want with one line of code and
is
> much much more efficient.
>
> Using GetRows() is simple and there are loads of articles on the net
> which explain it... the following Google search will get you
started :-
>
> http://www.google.co.uk/search?q=recordset+getrows
>
> Dan
>
> ________________________________
>
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of
Valter
> Sent: 02 November 2005 16:29
> To: [email protected]
> Subject: [AspClassicAnyQuestionIsOk] run time error Microsoft
VBScript
> (0x800A000D) - Type not corrispondent: 'x'
>
>
> I did wrote this code, but when I run it return me a run time error
> Microsoft VBScript (0x800A000D) - Type not corrispondent: 'x'.
> The line is 15 : x(i) = val("valore_quota")
> Here is the code:
> <%@ LANGUAGE="VBSCRIPT" %>
> <%
> Dim outpostDB
> Dim outpostDBPath
> stroutpostDBPath = Server.MapPath("../GestAlt/alternative.mdb")
> %>
> <%
> set outpostDB = Server.CreateObject("ADODB.Connection")
> outpostDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
> stroutpostDBPath & ";"
> %>
> <%
> set val = outpostDB.Execute("Select valore_quota from valori where
id
> = 1 and data_quota = #31/12/2004# ")
> i = 1
> Do While Not val.EOF
> x(i) = val("valore_quota")
> i = i +1
> val .MoveNext
> Loop
> %>
> <%
> set val2 = outpostDB.Execute("Select valore_quota from valori where
> id = 1 and data_quota =#30/09/2005# ")
> i = 1
> Do While Not val.EOF
> y(i) = val2("valore_quota")
> i = i +1
> val2.MoveNext
> Loop
> %>
> <%
> for j = 1 to i
> var_per(j) = ((y(j)/x(j))*100)-100
> %>
> <td><%= var_per(j) %></td>
> <%
> next
> val2.Close
> set val2 = Nothing
> %>
> <%
> val.Close
> set val = Nothing
> %>
>
> <%
> outpostDB.Close
> set outpostDB = Nothing
> %>
> Is there anybody can help me out with this?
> Thanks
> Valter
>
>
>
>
>
>
> ________________________________
>
> YAHOO! GROUPS LINKS
>
>
>
> * Visit your group "AspClassicAnyQuestionIsOk
> <http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk> " on the
web.
>
> * To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]
subject=Un
> subscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/> .
>
>
> ________________________________
>
>
>
>
> [Non-text portions of this message have been removed]
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/