Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2004
    Posts
    16

    Question Unanswered: Duplicate output

    I am trying to display the contents of my database, and occasionally (seemingly with no pattern) single entries in the database are displayed twice. It's almost as though the RS.MoveNext command is not executed every once in a while. This happens to the same entry each time i query the database, but the entry/entries it chooses to duplicate in the display aren't connected in any way. (I use the code to eliminate single quotes when i insert data, and i know for a fact there is only one entry in the database for the records duplicated.)

    Here is my code for the display loop:

    'Determine if any results were returned
    If RS.BOF and RS.EOF then
    response.write "<font type=arial size=2 color=yellow>There are no records associated with your search criteria"
    response.write "<br />Please try again."
    Else
    'Display lesson info


    DO WHILE NOT RS.EOF
    response.write "<TABLE border='1'>"
    response.write "<colgroup width = 150>"
    response.write "<colgroup width = 1000>"

    response.write "<TR><TD><font type=arial size=2 color=yellow>Report Number</TD>"
    response.write "<TD><font type=arial size=2 color=yellow>" & RS("rnumber") & "</TD></TR>"
    response.write "<TR><TD><font type=arial size=2 color=yellow>Report Title</TD>"
    response.write "<TD><font type=arial size=2 color=yellow>" & RS("rtitle") & "</TD></TR>"
    response.write "<TR><TD><font type=arial size=2 color=yellow>Report Date</TD>"
    response.write "<TD><font type=arial size=2 color=yellow>" & RS("rdate") & "</TD></TR>"
    response.write "<TR><TD><font type=arial size=2 color=yellow>Finding/Problem</TD>"
    response.write "<TD><font type=arial size=2 color=yellow><a href='http://securedevako.hqda.pentagon.mil/ako/g4-usf-website/logcap/updatelesson.asp?lid=" & RS("lid") & "'</a>" & RS("finding") & "</TD></TR>"
    response.write "<TR><TD><font type=arial size=2 color=yellow>Comments</TD>"
    response.write "<TD><font type=arial size=2 color=yellow>" & RS("comment") & "</TD></TR>"
    response.write "<TR><TD><font type=arial size=2 color=yellow>Recommendation</TD>"
    response.write "<TD><font type=arial size=2 color=yellow>" & RS("recommendation") & "</TD></TR>"
    response.write "<TR><TD><font type=arial size=2 color=yellow>Action Taken</TD>"
    response.write "<TD><font type=arial size=2 color=yellow>" & RS("action") & "</TD></TR>"
    response.write "<TR><TD><font type=arial size=2 color=yellow>Date of Action</TD>"
    response.write "<TD><font type=arial size=2 color=yellow>" & RS("date") & "</TD></TR>"
    response.write "<TR><TD><font type=arial size=2 color=yellow>Lead office</TD>"
    response.write "<TD><font type=arial size=2 color=yellow>" & RS("lead") & "</TD></TR>"
    cnumber = RS("cnumber")
    ctitle = RS("ctitle")
    datec = RS("cdate")
    response.write "<TR><TD><font type=arial size=2 color=yellow>Correction Title</TD>"
    response.write "<TD><font type=arial size=2 color=yellow><a href='" & RS("clink") & "'>" & ctitle & "</a></TD></TR>"
    response.write "<TR><TD><font type=arial size=2 color=yellow>Correction Number</TD>"
    response.write "<TD><font type=arial size=2 color=yellow>" & cnumber & "</TD></TR>"
    response.write "<TR><TD><font type=arial size=2 color=yellow>Correction Date</TD>"
    response.write "<TD><font type=arial size=2 color=yellow>" & datec & "</TD>"

    response.write "</TR>"

    response.write "</TABLE><br /><br />"

    RS.MoveNext
    LOOP

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    Could it be possible you have duplicates in your database? Or maybe your query has some bad joins that are creating duplicate results?
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Sep 2004
    Posts
    16
    I know for a fact that there is only one entry in the database for the entries that get duplicated, and as far as i know the joins are fine. This is the statement i use:

    'Request the lesson info
    v_query = "SELECT finding, comment, recommendation, action, date, lead, rnumber, rtitle, rdate, lid, cnumber, ctitle, cdate, clink"
    v_query = v_query & " FROM lesson, report, correction"
    v_query = v_query & " WHERE rnumber = rinfo and cnumber = cinfo and "
    v_query = v_query & v_category & " like '%" & v_input & "%'"
    v_query = v_query & " ORDER BY rinfo;"

    Set RS = oConn.Execute(v_query)

    That should only return each entry in the database one time. And if it were a bad join, wouldn't it return all of them twice, not just a few?

    Any other ideas?

  4. #4
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    "That should only return each entry in the database one time. And if it were a bad join, wouldn't it return all of them twice, not just a few?"

    Not necessarily. If an outer join was used, you may recieve one record for a parent without a child.

    It is hard to determine what is going on here from your query because your field names are not qualified with a table name, you are using the ANSI 92 join method instead of putting your join in your from clause and I have'nt the foggiest what your table structure is.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  5. #5
    Join Date
    Sep 2004
    Posts
    16
    Thanks for your help. I know it was a little muttled, but your comment helped. I went back and took a look at the join, and figured out through trail and error that i had multiple entries in one of the tables for the primary key, which was creating multiple entries in the join table. I've been working on this for days, and i can't believe it was that simple! Thanks for all your help! I'm sure i'll have plenty more muttled questions before this thing is done!

  6. #6
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    not a problem. I am here through Thursday evening and I stayed logged into DB Forums to break up the average day of a code monkey.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •