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

  1. #1

    Default Serial Numbers

    Hi All:

    I am trying to populate a database field that consists of incremented
    (serial) numbers. This is the code I am trying to get to work:
    objRs.AddNew
    for i = 49999 to 50999
    n2 = i + 1
    response.write "n2=" & n2 & "<br>"
    next
    for n = 0 to 1000
    objRs("bcksNo") = n2
    next
    objRs.Update

    Tthe response.write indicates that the numbers are being generated properly,
    however, I an getting an error message that the database can't be updated,
    because its creating duplicate values so apparently the loop I have there is
    not correct. I'm pretty new at this stuff, so really don't know how to
    correct this.

    Any help would be greatly appreciated

    Steve


    Steve G Guest

  2. Similar Questions and Discussions

    1. Serial Numbers for Freehand MX
      Hello, It is unable for me to download the upgrade for Freehand MX. I have purchased Studio MX with Freehand 10 last year. This spring I...
    2. how to print forms with serial numbers?
      I am trying to print work order forms or other Forms which have a serial number on them, anyone know how it is done? thank you!
    3. WSW (Studio MX) serial numbers seem to work now
      Started downloading my Freehand MXa update a few minutes ago...
    4. Upgrade using Studio Serial Numbers
      All, We are aware of the issue with being unable to use the Studio serial numbers to download the FreeHand MX version 11.0.1 installer. We hope...
    5. Serial IO
      Are there any less expensive alternatives to the DirectCommunication Xtra for simple serial IO in Director?
  3. #2

    Default Re: Serial Numbers


    AddNew just adds one new record (row), so if you're trying to add multiple
    records you'll have to AddNew for each one.
    What is the response.write for? Just to check the numbers?

    for i =1 to 100
    response.write "i=" & i & "<br>"
    objRs.AddNew
    objRs("bcksNo") = i
    next
    objRs.Update

    You'll have to make sure that the values you're inserting do not already
    exist. You should also look into using SQL inserts rather than a recordset
    to do your inserts.

    Tim.

    "Steve G" <steve@nospam.tnccreations.com> wrote in message
    news:u4EIaC8RDHA.2188@TK2MSFTNGP10.phx.gbl...
    > Hi All:
    >
    > I am trying to populate a database field that consists of incremented
    > (serial) numbers. This is the code I am trying to get to work:
    > objRs.AddNew
    > for i = 49999 to 50999
    > n2 = i + 1
    > response.write "n2=" & n2 & "<br>"
    > next
    > for n = 0 to 1000
    > objRs("bcksNo") = n2
    > next
    > objRs.Update
    >
    > Tthe response.write indicates that the numbers are being generated
    properly,
    > however, I an getting an error message that the database can't be updated,
    > because its creating duplicate values so apparently the loop I have there
    is
    > not correct. I'm pretty new at this stuff, so really don't know how to
    > correct this.
    >
    > Any help would be greatly appreciated
    >
    > Steve
    >
    >

    Tim Williams Guest

  4. #3

    Default Re: Serial Numbers

    Are there any other columns in the table?
    If so, do they have unique constraints on them?
    Did you empty the table between trial runs?

    --
    Mark Schupp
    --
    Head of Development
    Integrity eLearning
    Online Learning Solutions Provider
    [email]mschupp@ielearning.com[/email]
    [url]http://www.ielearning.com[/url]
    714.637.9480 x17


    "Steve G" <steve@nospam.tnccreations.com> wrote in message
    news:uuAk0z8RDHA.3880@tk2msftngp13.phx.gbl...
    > Thanks for your response Steven.
    >
    > Unfortunately, that is producing the same error message:
    > Microsoft JET Database Engine error '80040e21'
    >
    > The changes you requested to the table were not successful because they
    > would create duplicate values in the index, primary key, or relationship.
    > Change the data in the field or fields that contain duplicate data, remove
    > the index, or redefine the index to permit duplicate entries and try
    again.
    >
    > Steve
    >
    > "Merkling, Steven" <Steven.Merkling@udlp.com> wrote in message
    > news:uH%23Lsd8RDHA.3132@tk2msftngp13.phx.gbl...
    > > try this
    > >
    > > for n = 0 to 1000
    > > objRs.AddNew
    > > objRs("bcksNo") = n
    > > objRs.Update
    > > next
    > >
    > >
    >
    >

    Mark Schupp 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