Forum Moderators: open
function getImages(pid){
try{
var rsimg;
var counter = 0;
var arrImgs2 = new Array();
var sql = "SELECT * FROM property_image WHERE Property_ID=" + pid;
var cmd = new ActiveXObject("ADODB.Command");
cmd.ActiveConnection = dbConn;
cmd.CommandText = sql;
rsimg = cmd.Execute();
while(!rsimg.EOF){
counter = counter + 1;
arrImgs2[counter] = rsimg("ID");
WScript.Echo(arrImgs2[counter]);
rsimg.MoveNext();
}
WScript.Echo(arrImgs2[1]);
return arrImgs2;
}
catch(e){
WScript.Echo("Error getting images - " + e.name + " " + e.message + ".");
}
}
The line underneath arrImgs2[counter] = rsimg("ID") is to display the data of the array, and as you can see after the while loop ends i have done another one to check the data, the id numbers get put to the screen within the loop but when the one outside the loop tries, it fails.
any help would be really appreciated.
Thanks,
Adrian
And it tells me that this is happening on the line with the echo just after the loop.