I have a strange problem I can’t see a way around.
I have a large recordset (183 records and 89 fields). I want to do some dynamic things on a web page, as you do, but for some reason the array only fills with the last record. When you document.write the variables at various points in the while loop it looks fine, but when you try to write out the dataset again from the array, I only get the last record. 183 times!
Where is my stupid mistake!!!????
Here’s the code:
var svr; // Server object
var rst; // Recordset object
// Create a new Server and get all data.
svr = new ActiveXObject(“ADOVarietyData.ADOVarietyServer”);
rst = svr.DetailsForVarieties();
var arrFields = new Array();
var nRec = 0;
var x = 0;
rst.MoveFirst();
while (!rst.EOF) {
for (x = 0; x <= 89; x++){
arrFields[nRec,x] = rst.fields(x).value;
}
nRec++;
rst.MoveNext();
}
rst.close;
//LIST 1ST THREE RECORDS DATA
for (RecNo = 0; RecNo <= nRec; RecNo++){
for (nFieldNo = 0; nFieldNo <= 89; nFieldNo++){
if (RecNo <= 2){
document.write(arrFields[RecNo,nFieldNo] + “<br>”);
}
}
}