My Little Help Desk - ASP Help Forum
My Little Help Desk - ASP Help Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 My Little Help Desk - ASP Help
 Active Server Pages
 arrays with SQL
 New Topic  Reply to Topic
Author Topic  

fskilnik

Brazil
18 Posts

Posted - 05/19/2006 :  13:21:12  Show Profile  Reply with Quote
Hello alorentz and all!

From the code below I think what I intend to do is obvious. Please explain to me what is wrong and/or how to correct it!

Important: the SQL is working as expected, in the sense that given a StockID, it gets the counting number correctly.

Best regards and thanks a lot,
Fábio.


Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.Provider = "etc"
objConnection.ConnectionString = "etc"

objConnection.Open

NumberStocks = 2

Dim NumberOfRecords()

For I = 0 To NumberStocks

aux = "SELECT something.StockID, Count(something.SgnQtyShares) AS NumbPositShares FROM something GROUP BY something.StockID HAVING (((something.StockID)=" & I & ") AND ((Count(something.SgnQtyShares))>0));"

Set NumberOfRecords(I) = objConnection.execute(aux)

Next 'I

Obs.: substituting I at the SQL the problem persists (see error message below) therefore it seems to me that the real trouble is related to the NUmberOfRecords() definition or something like that.

Error Message:

Microsoft VBScript runtime (0x800A0009)
Subscript out of range

alorentz

66 Posts

Posted - 05/20/2006 :  10:34:19  Show Profile  Reply with Quote
Sorry for delay, again <grin>....


The problem is that the array needs to be intialized and defined:

dim NumberOfRecords(100)


Or:

dim NumberOfRecords()
redim NumberOfRecords(NumberOfStocks)

Go to Top of Page

fskilnik

Brazil
18 Posts

Posted - 05/22/2006 :  10:35:50  Show Profile  Reply with Quote
Please don´t mention any delay, alorentz! I am pretty sure you are always very busy with clients/projects and your good-will in helping us in your "leisure/spare time" is really admirable.

Now I see my mistake. I took the "dynamic array" approach too freely...

Thanks a lot and best regards,
Fábio.
Go to Top of Page
  Topic  
 New Topic  Reply to Topic
Jump To:
My Little Help Desk - ASP Help Forum © mylittlehelpdesk.com Go To Top Of Page
Snitz Forums 2000