Working with an array

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

    Working with an array

    Not certain this is the correct newsgroup to post this, but I hope someone
    here can help me. I am creating an array from a form field, parsing it, then
    posting the data to a database using classic ASP. The problem I am
    encountering is that the data is doubling up when posting. For example, if
    there is only one item in the array, it will post twice. Below is the code I
    am using: If anyone could be of any assistance, I sure would appreciate
    it....

    if Request.Form.Co unt 0 then
    if request.form("F ormCouponCode") <"" then
    formCpnCode = trim(request.fo rm("FormCouponC ode"))
    for i = 0 to 32
    formCpnCode = replace(formCpn Code,chr(i),"")
    next
    codeArray = split(formCpnCo de,",")
    codeArrayCount = uBound(codeArra y)

    for i = 0 to codeArrayCount
    item = codeArray(i)
    sql = "SELECT bucksID, bcksNo, bcksOrderID, bcksValue,
    bcksActive, bcksCpType FROM bobBucks WHERE bcksNo='" & item & "' and
    (bcksActive='ye s' or bcksActive='Yes ')"
    Set rst = Server.CreateOb ject("ADODB.Rec ordSet")
    rst.Open sql, cnn
    if rst.eof then
    isCouponGood="n o"
    bckValue=0
    else
    isCouponGood=rs t("bcksActive ")
    bckValue=rst("b cksValue")
    end if
    dim rSql,rst1
    Set rst1 = Server.CreateOb ject("ADODB.Rec ordSet")
    rSql = "Select * FROM sfTmpOrdersAE"
    rst1.Open rSql, cnn, adOpenStatic, adLockOptimisti c
    rst1.AddNew
    rst1("odrtmpSes sionId") = Session("Sessio nID")
    rst1("odrtmpCou ponCode") = item
    rst1("odrtmpIsA ctive") = isCouponGood
    rst1("odrtmpVal ue") = bckValue
    rst1.update

    next
    end if
    end if

    Steve


  • =?Utf-8?B?T2xkIFBlZGFudA==?=

    #2
    RE: Working with an array



    "Steve" wrote:
    Not certain this is the correct newsgroup to post this,
    It is.

    But it's not nice to post the same question multiple places. Means that you
    might cause several people to take the time to give you the same answers.

    At a minimum, you should mention that you have posted in the other forum(s).

    Anyway, I answered you here:



    Comment

    • Steve

      #3
      Re: Working with an array

      I did not realize the two forums were so closely associated with each
      other...normall y, I do not post at multiple forums, especially microsoft
      ones, but in this case I did not think anyone was going to reply at the asp
      message board....I do apologize if that has offended you or anyone else
      here.

      Steve

      "Old Pedant" <OldPedant@disc ussions.microso ft.comwrote in message
      news:37A1C018-1765-4B0F-B264-B3CA64BC3E11@mi crosoft.com...
      >
      >
      "Steve" wrote:
      >
      >Not certain this is the correct newsgroup to post this,
      >
      It is.
      >
      But it's not nice to post the same question multiple places. Means that
      you
      might cause several people to take the time to give you the same answers.
      >
      At a minimum, you should mention that you have posted in the other
      forum(s).
      >
      Anyway, I answered you here:

      >
      >

      Comment

      • Bob Barrows [MVP]

        #4
        Re: Working with an array

        no harm, no foul.

        If I _had_ wasted time composing a reply, that would have been a different
        story :-)
        Steve wrote:
        I did not realize the two forums were so closely associated with each
        other...normall y, I do not post at multiple forums, especially
        microsoft ones, but in this case I did not think anyone was going to
        reply at the asp message board....I do apologize if that has offended
        you or anyone else here.
        >
        Steve
        >
        "Old Pedant" <OldPedant@disc ussions.microso ft.comwrote in message
        news:37A1C018-1765-4B0F-B264-B3CA64BC3E11@mi crosoft.com...
        >>
        >>
        >"Steve" wrote:
        >>
        >>Not certain this is the correct newsgroup to post this,
        >>
        >It is.
        >>
        >But it's not nice to post the same question multiple places. Means
        >that you
        >might cause several people to take the time to give you the same
        >answers. At a minimum, you should mention that you have posted in the
        >other
        >forum(s).
        >>
        >Anyway, I answered you here:
        >http://www.aspmessageboard.com/forum...98572&F=20&P=1
        --
        Microsoft MVP - ASP/ASP.NET
        Please reply to the newsgroup. This email account is my spam trap so I
        don't check it very often. If you must reply off-line, then remove the
        "NO SPAM"


        Comment

        • =?Utf-8?B?T2xkIFBlZGFudA==?=

          #5
          Re: Working with an array



          "Steve" wrote:
          I do apologize if that has offended you or anyone else here.
          No offense taken, at all. Didn't mean to imply any. And no, the forums
          aren't closely linked; I think only a handful of us see both. But, still,
          it's just good netiquette to say you are posting multiple places, so somebody
          can check to see that your question has already been answered, if they want
          to, to avoid repetition of work.

          Anyway, if I came on too strong, I apologize.


          Comment

          • =?Utf-8?B?T2xkIFBlZGFudA==?=

            #6
            RE: Working with an array

            "Steve" wrote:
            Not certain this is the correct newsgroup to post this, but I hope someone
            here can help me. I am creating an array from a form field, parsing it, then
            posting the data to a database using classic ASP. The problem I am
            encountering is that the data is doubling up when posting.
            If anyone cares... The problem had nothing to do with array usage. Steve had
            <input type=submit onclick="this.f orm.submit( );" ...>
            and so of course the HTML was submitting the form twice.


            Comment

            Working...