Array question

J

John Hoge

I'm looking to make an admin page for a web photo gallery, and I need
to make a drop down menu showing all files in a given directory that
do not have comments in a database for the given filename.

I'm curious about the most efficient way to do this. I don't want to
query the database separately for each file as this would be horribly
inefficient. I'm thinking about two arrays, one containing all
filenames in the photo directory, and one containing filenames from
the database that have descriptions.

Is there a simple way in ADO to do a set operation on arrays, that is
to produce array C that has all elements in array A that are not
contained in array B?

I can do this with while loops, but there must be a better way!

John
 
C

Chris Barber

Do all the filenames exist in the database or is this a loosely coupled
system where there may be more or less images in the directory than exist in
the database?

Chris.

I'm looking to make an admin page for a web photo gallery, and I need
to make a drop down menu showing all files in a given directory that
do not have comments in a database for the given filename.

I'm curious about the most efficient way to do this. I don't want to
query the database separately for each file as this would be horribly
inefficient. I'm thinking about two arrays, one containing all
filenames in the photo directory, and one containing filenames from
the database that have descriptions.

Is there a simple way in ADO to do a set operation on arrays, that is
to produce array C that has all elements in array A that are not
contained in array B?

I can do this with while loops, but there must be a better way!

John
 
D

dlbjr

A better fix would be to control the graphic files when added.

Allow a file upload only with a comment through an asp page.

You can then control file size limits and file naming convention
and maintain all the data in the database.

-------------------------------------------------
d l b j r

Unambit from meager knowledge of inane others,
engender uncharted sagacity.
-------------------------------------------------
 
J

John Hoge

Chris,

I didn't want to mess with a file upload component, so I just FTP the
image files to a specific directory. After they are on the website, I
use the admin page to enter the filename & caption into a database. I
originally thought I would just key in the filenames as they are
uploaded, which works just fine.

A better admin page would look for any files in the gallery directory
that are not in database and populate a drop down menu with them. So I
want to create one array from a scripting.filesystemobject with every
filename in the directory, and create a second with each entry in the
database, and run a set operation to leave only those filenames that
are in the image directory but not in the database.

Perhaps I'm looking for more out of ASP than it can do, but I think
it's always a good idea to look for innovative solutions rather than
just cranking out inefficient code.

Thanks a lot,

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,206
Latest member
Zenden

Latest Threads

Top