Lets see if you can figure this out....

Discussion in 'ASP General' started by Ron, Sep 29, 2003.

  1. Ron

    Ron Guest

    I am trying to take a field from a database and correspond that field to a
    file in a folder. Here is the code I have so far. The files in the folder
    have corresponding numbers but they also have letters and extentions I have
    removed those now I just need to check each file with the field. I cannot
    seem to get it to work. Here is the code

    <%
    Response.Buffer = True
    Server.ScriptTimeout =500
    set objFSO = CreateObject("Scripting.FileSystemObject")
    'this is the folder you want to check change this to point to your folder
    Set objFolder =
    objFSO.GetFolder("Z:\webspace\kansas\kansasmultimedia\kansasmultimedia.com\w
    ww\topekavow\housephotos\")

    Set colFiles = objFolder.Files
    dim dbarray()
    dim rsarray()
    Dim MyString, MyArray
    dim dbcheck
    For Each objFile in colFiles


    filename=objfile.name
    if right(filename,4)<>".jpg" then

    else

    MyString = filename
    MyArray = Split(MyString, "-")

    idnumber=Replace(myarray(0), "TOPEKA", "")
    idnumber=Replace(idnumber, ".jpg", "")

    idnumber=Replace(idnumber, "a", "")
    idnumber=Replace(idnumber, "b", "")
    idnumber=Replace(idnumber, "c", "")
    idnumber=Replace(idnumber, "d", "")
    idnumber=Replace(idnumber, "e", "")
    idnumber=Replace(idnumber, "f", "")
    idnumber=Replace(idnumber, "g", "")
    idnumber=Replace(idnumber, "h", "")
    idnumber=Replace(idnumber, "i", "")
    idnumber=Replace(idnumber, "j", "")
    idnumber=Replace(idnumber, "k", "")
    idnumber=Replace(idnumber, "l", "")
    idnumber=Replace(idnumber, "m", "")
    idnumber=Replace(idnumber, "n", "")
    idnumber=Replace(idnumber, "o", "")
    idnumber=Replace(idnumber, "p", "")
    idnumber=Replace(idnumber, "q", "")
    idnumber=Replace(idnumber, "r", "")
    idnumber=Replace(idnumber, "s", "")
    idnumber=Replace(idnumber, "t", "")
    idnumber=Replace(idnumber, "u", "")
    idnumber=Replace(idnumber, "v", "")
    idnumber=Replace(idnumber, "w", "")
    idnumber=Replace(idnumber, "x", "")
    idnumber=Replace(idnumber, "y", "")
    idnumber=Replace(idnumber, "z", "")

    dupcheck=dbcheck
    dbcheck=idnumber

    if dbcheck=dupcheck then

    else

    count=count+1

    redim preserve dbarray(count)
    dbarray(count)=dbcheck
    end if



    end if

    next

    %>








    <%

    Set MyConn=Server.CreateObject("ADODB.Connection")
    MyConn.Open "DSN=Vowdsn"


    set rs=server.createobject("adodb.recordset")


    %>

    <%
    rssql="SELECT * FROM [ListingsResidential-Residential] where
    field41<date()-14"

    rs.open rssql,myconn
    RESPONSE.WRITE "THESE ARE ALL RECORDS THAT ARE OLDER THAN 14 DAYS<BR><BR>"
    %>
    <TABLE border="1">
    <TR><TD bgcolor="#c0c0c0"><h3>FIELD1</h1></TD></TR>
    <%
    do until rs.eof
    %>

    <tr><td><%



    FOR X=0 TO COUNT

    IF DBARRAY(X)=RS("FIELD1") THEN

    ELSE
    RESPONSE.WRITE RS("FIELD1") & " " & RS("FIELD41")
    END IF

    NEXT


    %></td></tr>

    <%
    rs.movenext
    loop



    rs.close

    %>
    </TABLE>

    <%


    %>

    Thanks Ron
    Ron, Sep 29, 2003
    #1
    1. Advertising

  2. Ron

    Bob Barrows Guest

    Ron wrote:
    > I am trying to take a field from a database and correspond that field
    > to a file in a folder. Here is the code I have so far. The files in
    > the folder have corresponding numbers but they also have letters and
    > extentions I have removed those now I just need to check each file
    > with the field. I cannot seem to get it to work. Here is the code


    "cannot ... get it to work" is not helpful.

    What are the symptoms? I will not read your whole script hoping to deduce
    what's going on. Tell me what the symptoms are so I can concentrate on the
    relevant bits of your code.

    Bob Barrows
    Bob Barrows, Sep 29, 2003
    #2
    1. Advertising

  3. Ron

    Randy Rahbar Guest

    > IF DBARRAY(X)=RS("FIELD1") THEN

    What if you try... IF cstr(DBARRAY(X)) = cstr(RS("FIELD1")) THEN
    Randy Rahbar, Sep 29, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Flip
    Replies:
    3
    Views:
    972
    Tony Morris
    Feb 9, 2004
  2. xyZed
    Replies:
    3
    Views:
    1,354
    Jacqui or (maybe) Pete
    Jun 29, 2003
  3. Kamilche

    Python 'Lets Me See The Forest'

    Kamilche, Jun 4, 2004, in forum: Python
    Replies:
    7
    Views:
    307
    James Moughan
    Jun 8, 2004
  4. John
    Replies:
    2
    Views:
    125
    Bob Barrows
    Sep 30, 2003
  5. Replies:
    2
    Views:
    117
Loading...

Share This Page