Mailing App Duplicate problem...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • @sh

    Mailing App Duplicate problem...

    Guys,

    I've written an email sending script to mass send to our database - some of
    our subscribers are subscribed to multiple list, and so when selecting the
    entire database, I want to ensure I don't have Duplicates.

    To avoid this, I am selecting the recordset of all users, ordering by Email
    address, sending the email, moving onto the next record and then starting a
    loop to keep looping until the email address is different, but it doesn't
    work... see example below...

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

    Do While NOT RS_RecipientsFo rCampaign.EOF

    SEND THE EMAIL HERE...

    RS_RecipientsFo rCampaign.MoveN ext

    If NOT RS_RecipientsFo rCampaign.EOF Then
    ** Do While TheUsersEmailAd dress =
    RS_RecipientsFo rCampaign("Emai l") AND NOT RS_RecipientsFo rCampaign.EOF
    RS_RecipientsFo rCampaign.MoveN ext
    Loop
    End If

    Loop

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

    When running, the script works fine, BUT I get an Unspecified error (I HATE
    that message) at the end of the script, pointing me to the line number
    marked with ** above.

    How can I cure this? I've tried everything but need a solution to amend this
    section of code that works!!

    Cheers, Ash


  • @sh

    #2
    Re: Mailing App Duplicate problem...

    Actually, sorry just to confirm, here is the exact error message...

    error '80020009'
    Exception occurred.
    blah.asp, line 799



    "@sh" <spam@spam.comw rote in message
    news:6MSdncFkBd K1ljDZnZ2dnUVZ8 qOdnZ2d@bt.com. ..
    Guys,
    >
    I've written an email sending script to mass send to our database - some
    of our subscribers are subscribed to multiple list, and so when selecting
    the entire database, I want to ensure I don't have Duplicates.
    >
    To avoid this, I am selecting the recordset of all users, ordering by
    Email address, sending the email, moving onto the next record and then
    starting a loop to keep looping until the email address is different, but
    it doesn't work... see example below...
    >
    -----------------------------------
    >
    Do While NOT RS_RecipientsFo rCampaign.EOF
    >
    SEND THE EMAIL HERE...
    >
    RS_RecipientsFo rCampaign.MoveN ext
    >
    If NOT RS_RecipientsFo rCampaign.EOF Then
    ** Do While TheUsersEmailAd dress =
    RS_RecipientsFo rCampaign("Emai l") AND NOT RS_RecipientsFo rCampaign.EOF
    RS_RecipientsFo rCampaign.MoveN ext
    Loop
    End If
    >
    Loop
    >
    -----------------------------------
    >
    When running, the script works fine, BUT I get an Unspecified error (I
    HATE that message) at the end of the script, pointing me to the line
    number marked with ** above.
    >
    How can I cure this? I've tried everything but need a solution to amend
    this section of code that works!!
    >
    Cheers, Ash
    >

    Comment

    • Bob Barrows [MVP]

      #3
      Re: Mailing App Duplicate problem...

      @sh wrote:
      Guys,
      >
      I've written an email sending script to mass send to our database -
      some of our subscribers are subscribed to multiple list, and so when
      selecting the entire database, I want to ensure I don't have
      Duplicates.
      >
      To avoid this, I am selecting the recordset of all users, ordering by
      Email address, sending the email, moving onto the next record and
      then starting a loop to keep looping until the email address is
      different, but it doesn't work... see example below...
      >
      -----------------------------------
      >
      Do While NOT RS_RecipientsFo rCampaign.EOF
      >
      SEND THE EMAIL HERE...
      >
      RS_RecipientsFo rCampaign.MoveN ext
      >
      If NOT RS_RecipientsFo rCampaign.EOF Then
      ** Do While TheUsersEmailAd dress =
      RS_RecipientsFo rCampaign("Emai l") AND NOT RS_RecipientsFo rCampaign.EOF
      RS_RecipientsFo rCampaign.MoveN ext
      Loop
      End If
      >
      Loop
      >
      -----------------------------------
      >
      When running, the script works fine, BUT I get an Unspecified error
      (I HATE that message) at the end of the script, pointing me to the
      line number marked with ** above.
      >
      How can I cure this? I've tried everything but need a solution to
      amend this section of code that works!!
      >
      You should be able to construct a query that returns unique addresses.
      However, the details for how that would be done depend on the database
      type and version you are using (please always supply this information
      when requesting database-related help. It is almost always relevant)

      --
      Microsoft MVP -- ASP/ASP.NET
      Please reply to the newsgroup. The email account listed in my From
      header is my spam trap, so I don't check it very often. You will get a
      quicker response by posting to the newsgroup.


      Comment

      • @sh

        #4
        Re: Mailing App Duplicate problem...

        You should be able to construct a query that returns unique addresses.
        However, the details for how that would be done depend on the database
        type and version you are using (please always supply this information
        when requesting database-related help. It is almost always relevant)
        Thanks for your reply. We're using SQLServer v7, I did consider how to
        return unique addresses, perhaps by using Distinct, but we also need
        alongside that the other details for the user, for example title, firstname,
        lastname etc.

        Surely there is a simple solution to get this script working? What am I
        missing?


        Comment

        • @sh

          #5
          Re: Mailing App Duplicate problem... SOLVED!

          Just solved it myself, for anyone else with the same problem, you need to
          look into the 'Exit Do' function, VERY DAMN HANDY!!!!

          Final code bit now looks like this...

          Do While NOT RS_RecipientsFo rCampaign.EOF
          If (TheUsersEmailA ddress <>
          RS_RecipientsFo rCampaign("Emai l")) Then
          Exit Do
          Else
          RS_RecipientsFo rCampaign.MoveN ext
          End If
          Loop

          Cheers, @sh


          "@sh" <spam@spam.comw rote in message
          news:a5mdncoAy8 t9jTDZnZ2dnUVZ8 s2dnZ2d@bt.com. ..
          >You should be able to construct a query that returns unique addresses.
          >However, the details for how that would be done depend on the database
          >type and version you are using (please always supply this information
          >when requesting database-related help. It is almost always relevant)
          >
          Thanks for your reply. We're using SQLServer v7, I did consider how to
          return unique addresses, perhaps by using Distinct, but we also need
          alongside that the other details for the user, for example title,
          firstname, lastname etc.
          >
          Surely there is a simple solution to get this script working? What am I
          missing?
          >

          Comment

          • Bob Barrows [MVP]

            #6
            Re: Mailing App Duplicate problem...

            @sh wrote:
            >You should be able to construct a query that returns unique
            >addresses. However, the details for how that would be done depend on
            >the database type and version you are using (please always supply
            >this information when requesting database-related help. It is almost
            >always relevant)
            >
            Thanks for your reply. We're using SQLServer v7, I did consider how to
            return unique addresses, perhaps by using Distinct, but we also need
            alongside that the other details for the user, for example title,
            firstname, lastname etc.
            Then use GROUP BY

            Of course, now I need to know something about your table's structure.
            However, something like:

            SELECT email, Max(title) title, Max(firstname) firstname,
            Max(lastname) lastname
            from table
            group by email
            >
            Surely there is a simple solution to get this script working?
            Probably, but I wouldn't bother with this inefficient technique.
            Concentrate on retrieving the correct data from your database. Never
            retrieve more data than you are going to use.

            --
            Microsoft MVP -- ASP/ASP.NET
            Please reply to the newsgroup. The email account listed in my From
            header is my spam trap, so I don't check it very often. You will get a
            quicker response by posting to the newsgroup.


            Comment

            • @sh

              #7
              Re: Mailing App Duplicate problem...

              Thanks for your help Bob, will look at reworking the SQL later on, got to
              just get the thing working for now ;o)

              Cheers, @sh


              Comment

              Working...