Duplicate value appears on page for 1 field in 1 record

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Duplicate value appears on page for 1 field in 1 record

    This is very very strange. I have an ASP page that reads records from
    a database and displays a list of them

    on the screen. For some reason the FirstName field for one of the
    records gets displayed twice on the screen

    For Example...

    0391 Richard
    0392 Leonard
    0395 Ken
    0396 Ronnie
    0397 Stefan Stefan
    0340 Phil

    I have checked the database and the actual value in that field in the
    database is fine, the name only appears

    once, so I know it's not the database.

    What's more is that when you click on the persons file number it loads
    another page that displayed their

    information... city, age, astrological sign etc... and the name for
    that one profile is being duplicated on

    that page too! The code is exactly the same for each person, I just
    pass the persons File number to the

    details page and it loads that persons details.

    To help figure out where that second name was coming from I put the
    word "Test" after the first name in the

    database and then I started getting "Stefan Test Stefan" whenever his
    name was displayed on a webpage. Once I

    realised it wasn't the database value I changed it back to the
    original. I tried to do a temporary fix for

    this be creating an if statement similar to the following...

    IF FirstName = "Stefan Stefan" THEN
    FirstName = "Stefan"
    END IF

    .... but that did not work! I have tried several variations on it, but
    none seem to work. My theory is that

    the duplicate name is getting added when the name is being
    displayed... at least that would explain why none

    of my if statements work. It never seems to match the value, even
    when I try...

    IF ucase(FirstName) = "STEFAN STEFAN"

    .... I know there are no leading or trailing spaces either because I
    have checked for that. I have even tried

    it with a single value...

    IF ucase(FirstName) = "STEFAN" THEN

    .... but nothing there either, the acutal value of the FirstName field
    seems to be impossible to determine. I

    cannot seem to match it so I can correct it and when it's displayed it
    appears twice!

    It's driving me nuts and I can't make any sense out of it.

    Here is some of the code if it helps...

    -------------------------------------------

    Set oConn=Server.CreateObject("ADODB.Connection")
    oConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
    "M:\database\asinglealternative\asa.mdb")

    strSQL = "SELECT * FROM tblContact WHERE Gender = 'MALE' AND Web =
    true AND IsActive = true AND ProfileType <> 'Private'"

    SET rsMember = oConn.execute (strSQL)

    <HTML>
    <HEAD>
    <TITLE>A Single Alternative: Search Results</title>

    <link type="text/css" rel="StyleSheet" href="Scripts/styles.txt">

    </head>

    <body topmargin="5" leftmargin="10" marginheight="5" marginwidth="10">

    <TABLE cellpadding=0 cellspacing=0 border=0 width=100%>


    <%IF rsMember.BOF = true OR rsMember.EOF = true THEN %>

    <tr>
    <td colspan=10>No Results to Display, please try <a
    href="profile_search.asp"> another search</a></td>
    </tr>

    <%ELSE%>

    <tr>
    <td nowrap><b>File*#***</b></td>
    <td nowrap><b>First Name***</b></td>
    <td nowrap><b>Age***</b></td>
    <td nowrap><b>City***</b></td>
    <td nowrap><b>Status***</b></td>
    </tr>

    <tr>
    <td bgcolor=white height=1 colspan=6></td>
    </tr>

    <tr>
    <td height=2></td>
    </tr>

    <% WHILE NOT rsMember.EOF

    IF UCase(rsMember("ProfileType")) = "SEMI-PRIVATE" THEN
    FirstName = "Private"
    ELSE
    FirstName = rsMember("FirstName")
    END IF

    %>

    <TR align='Left'>
    <td nowrap><a
    href="profile_view.asp?ID=<%=rsMember("FileNum")%> "><%=rsMember("FileNum")%>
    </a></td>
    <td nowrap style="color:#660000">*<%=FirstName%> </td>
    </TR>

    ....


    I'm really not sure where that stuff is going wrong!
    Brisko Guest

  2. Similar Questions and Discussions

    1. Duplicate Record Inserts
      The problem is that records are not being inserted only once. The included code is processed in a page after a form. The following 3 events randomly...
    2. Compare record field with another record field of samerecordset
      :confused; ... but I don't know how to refer to field of next record in loop through recordset. Any ideas? Thanks, WolfShade
    3. Duplicate record insertion
      Hi there, I have a DW insert record behaviour on a php page. If the user clicks Submit quickly multiple times, I end up with duplicate records. Any...
    4. MS Access SQL: duplicate record... ?SELECT INTO....?
      What syntax would you use to dupe a record? Thanks! -- Scotter
    5. Duplicate a record in a table from a Form.
      I am trying to duplicate a record within the same table. Basically I have fields that will always be the same. Field 2 and 3 will always equal...
  3. #2

    Default Re: Duplicate value appears on page for 1 field in 1 record

    "Brisko" <benverwey@hotmail.com> wrote in message
    news:96c03c8a.0307231523.1d212db5@posting.google.c om...
    > This is very very strange. I have an ASP page that reads records from
    > a database and displays a list of them
    >
    > on the screen. For some reason the FirstName field for one of the
    > records gets displayed twice on the screen
    >
    > For Example...
    >
    > 0391 Richard
    > 0392 Leonard
    > 0395 Ken
    > 0396 Ronnie
    > 0397 Stefan Stefan
    > 0340 Phil
    >
    > I have checked the database and the actual value in that field in the
    > database is fine, the name only appears
    >
    > once, so I know it's not the database.
    >
    > What's more is that when you click on the persons file number it loads
    > another page that displayed their
    >
    > information... city, age, astrological sign etc... and the name for
    > that one profile is being duplicated on
    >
    > that page too! The code is exactly the same for each person, I just
    > pass the persons File number to the
    >
    > details page and it loads that persons details.
    >
    > To help figure out where that second name was coming from I put the
    > word "Test" after the first name in the
    >
    > database and then I started getting "Stefan Test Stefan" whenever his
    > name was displayed on a webpage. Once I
    >
    > realised it wasn't the database value I changed it back to the
    > original. I tried to do a temporary fix for
    >
    > this be creating an if statement similar to the following...
    >
    > IF FirstName = "Stefan Stefan" THEN
    > FirstName = "Stefan"
    > END IF
    >
    > ... but that did not work! I have tried several variations on it, but
    > none seem to work. My theory is that
    >
    > the duplicate name is getting added when the name is being
    > displayed... at least that would explain why none
    >
    > of my if statements work. It never seems to match the value, even
    > when I try...
    >
    > IF ucase(FirstName) = "STEFAN STEFAN"
    >
    > ... I know there are no leading or trailing spaces either because I
    > have checked for that. I have even tried
    >
    > it with a single value...
    >
    > IF ucase(FirstName) = "STEFAN" THEN
    >
    > ... but nothing there either, the acutal value of the FirstName field
    > seems to be impossible to determine. I
    >
    > cannot seem to match it so I can correct it and when it's displayed it
    > appears twice!
    >
    > It's driving me nuts and I can't make any sense out of it.
    >
    > Here is some of the code if it helps...
    >
    > -------------------------------------------
    >
    > Set oConn=Server.CreateObject("ADODB.Connection")
    > oConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
    > "M:\database\asinglealternative\asa.mdb")
    >
    > strSQL = "SELECT * FROM tblContact WHERE Gender = 'MALE' AND Web =
    > true AND IsActive = true AND ProfileType <> 'Private'"
    >
    > SET rsMember = oConn.execute (strSQL)
    >
    > <HTML>
    > <HEAD>
    > <TITLE>A Single Alternative: Search Results</title>
    >
    > <link type="text/css" rel="StyleSheet" href="Scripts/styles.txt">
    >
    > </head>
    >
    > <body topmargin="5" leftmargin="10" marginheight="5" marginwidth="10">
    >
    > <TABLE cellpadding=0 cellspacing=0 border=0 width=100%>
    >
    >
    > <%IF rsMember.BOF = true OR rsMember.EOF = true THEN %>
    >
    > <tr>
    > <td colspan=10>No Results to Display, please try <a
    > href="profile_search.asp"> another search</a></td>
    > </tr>
    >
    > <%ELSE%>
    >
    > <tr>
    > <td nowrap><b>File # </b></td>
    > <td nowrap><b>First Name </b></td>
    > <td nowrap><b>Age </b></td>
    > <td nowrap><b>City </b></td>
    > <td nowrap><b>Status </b></td>
    > </tr>
    >
    > <tr>
    > <td bgcolor=white height=1 colspan=6></td>
    > </tr>
    >
    > <tr>
    > <td height=2></td>
    > </tr>
    >
    > <% WHILE NOT rsMember.EOF
    >
    > IF UCase(rsMember("ProfileType")) = "SEMI-PRIVATE" THEN
    > FirstName = "Private"
    > ELSE
    > FirstName = rsMember("FirstName")
    > END IF
    >
    > %>
    >
    > <TR align='Left'>
    > <td nowrap><a
    >
    href="profile_view.asp?ID=<%=rsMember("FileNum")%> "><%=rsMember("FileNum
    ")%>
    > </a></td>
    > <td nowrap style="color:#660000"> <%=FirstName%> </td>
    > </TR>
    >
    > ...
    >
    >
    > I'm really not sure where that stuff is going wrong!
    Just a guess, but you may have embedded a carriage return in the name,
    i.e. ALT-ENTER. Try expanding the row height when viewing the datasheet.

    HTH
    -Chris


    Chris Hohmann Guest

  4. #3

    Default Re: Duplicate value appears on page for 1 field in 1 record

    EXCELLENT! You nailed that one!

    Apparently some of the fields got fudged during the data transfer from
    the old database to the new one. When I increased the height of the
    records in the database I say that some of the fields had a second line
    below the one that I could see.

    You totally saved my ass. The site is supposed to launch tomorrow! It
    was a minor issue, but would really have bugged me.

    A million thanks,
    Ben



    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Ben Verwey Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139