ReddMurphy
02-05-2007, 02:21 PM
Hi,
I am looping through a small recordset using JScript and getting strange results. Here's the relevant code:
Code:
theArray = new Array();
theCount = 0;
while(!rst.EOF){
theArray[theCount] = rst("columnname");
theCount++; rst.MoveNext();
}
I happen to have 5 records in the recordset: "Home", "Search", "Exercises", "Workflow", and "Help".
In my loop, I added some Response.Writes so I could watch the value of each element in the array.
After the first iteration, theArray[0]="Home" as expected.
After the second iteration, both [0] and [1] are set to "Search".
After the third iteration, [0],[1], and [2] are all set to "Exercises" and so on...
I can only assume that I do not understand how arrays work because this seems very simple to me. Perhaps there is some difference between JScript and javascript that is causing my confusion?
Any help is GREATLY appreciated!
Thanks
Reply With Quote
I am looping through a small recordset using JScript and getting strange results. Here's the relevant code:
Code:
theArray = new Array();
theCount = 0;
while(!rst.EOF){
theArray[theCount] = rst("columnname");
theCount++; rst.MoveNext();
}
I happen to have 5 records in the recordset: "Home", "Search", "Exercises", "Workflow", and "Help".
In my loop, I added some Response.Writes so I could watch the value of each element in the array.
After the first iteration, theArray[0]="Home" as expected.
After the second iteration, both [0] and [1] are set to "Search".
After the third iteration, [0],[1], and [2] are all set to "Exercises" and so on...
I can only assume that I do not understand how arrays work because this seems very simple to me. Perhaps there is some difference between JScript and javascript that is causing my confusion?
Any help is GREATLY appreciated!
Thanks
Reply With Quote