Array question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Hoge

    Array question

    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
  • Chris Barber

    #2
    Re: Array question

    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.

    "John Hoge" <jhoge123@yahoo .com> wrote in message
    news:d0f2d316.0 307241519.cd5f3 4c@posting.goog le.com...
    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


    Comment

    • James Monroe

      #3
      Re: Array question

      sounds like fun

      I got sick of working on my own photo solutions and now I use this
      so far I really like it






      "Chris Barber" <chris@blue-canoe.co.uk.NOS PAM> wrote in message
      news:%23iij9LkU DHA.360@TK2MSFT NGP11.phx.gbl.. .[color=blue]
      > 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[/color]
      in[color=blue]
      > the database?
      >
      > Chris.
      >
      > "John Hoge" <jhoge123@yahoo .com> wrote in message
      > news:d0f2d316.0 307241519.cd5f3 4c@posting.goog le.com...
      > 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
      >
      >[/color]


      Comment

      • dlbjr

        #4
        Re: Array question

        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.
        -------------------------------------------------


        Comment

        • John Hoge

          #5
          Re: Array question

          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.files ystemobject 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

          "Chris Barber" <chris@blue-canoe.co.uk.NOS PAM> wrote in message news:<#iij9LkUD HA.360@TK2MSFTN GP11.phx.gbl>.. .[color=blue]
          > 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.
          >
          > "John Hoge" <jhoge123@yahoo .com> wrote in message
          > news:d0f2d316.0 307241519.cd5f3 4c@posting.goog le.com...
          > 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[/color]

          Comment

          Working...