ASP Array Question

admin

Administrator
Staff member
I have an array and I am checking it against the contents of a database. If I find an array element that is also in the db I want to delete the entry from the array (not from the database). What is the easiest way to do this?

Thanks!Query the database then in your loop for comparing them
Redim the array copy the contents of the array into another and return the array, continue to you reach the end.

You will have to go backwards through the array as you might reach an Out Of Bounds Error the other way ..


For i = Ubound(ary)-1 to 0 Step -1
'Do your stuff
NextThanks. Actually what I did was just add another boolean dimension to the array and if I found a match in the db I marked it as true. Then I only wrote the ones to the db that were false. That way I didn't have to delete anything--I just wrote the ones to the db that were unique.You could just have queryed the db for it like so

select * from tbl where field in (1,2,4,8)

Then in ASP loop till you find the values in the array. Once you do flag them then.
 
Back
Top