Increment row number starting at 1

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

  1. #1

    Default Increment row number starting at 1

    I have an asp page which displays database results in a table - (this is an
    invoice page).
    I have a variable called Row_Num which stores the row ID. Each time I add an
    item, I need the Row_Num var to increment by 1.

    SELECT Item_Desc,Item_Price FROM Line_Items WHERE OrderNum = 00123

    Row 1 Item Qty Price Subtotal
    Row 2 Item Qty Price Subtotal
    Row 3 Item Qty Price Subtotal
    Row 4 Item Qty Price Subtotal

    There is also an option to delete a row so the Row_Num var would need to be
    adjusted - say I deleted Row 2, Row 3 would need to change to Row 2 and Row
    4 would change to Row 3 in order to keep the correct number of rows.

    Im stuck on the incrementing part.
    I think I need a loop to the incrememnting but am not sure how to do it.
    Any help greatly appreciated.

    Thanks!



    Targa Guest

  2. Similar Questions and Discussions

    1. Access update, CFLOOP, number increment
      I have a table with four columns. field0 | field1 | field3 | field10 (primary key) L ABC 101 ...
    2. Change starting page number
      Hello--I am working on a large document that must be broken into pieces for multiple users to work on. I need to number the pages of these...
    3. #25626 [Opn->Bgs]: Variables containing number starting with 0 (Zero) become 0 (Zero)
      ID: 25626 Updated by: sniper@php.net Reported By: sameh dot attia at tedata dot net -Status: Open +Status: ...
    4. Auto Increment a number field
      I have a memo field (History) and a number field (Count). What I require is that when the history field is updated then the count field will...
    5. Increment a number in a text field
      I'm having problems getting a text field to automatically increment, exp. when you add a record to a form, it should automatically give a new id...
  3. #2

    Default Re: Increment row number starting at 1

    Got it figured out - thanks.

    <% Do While Not RS.EOF %>
    <% Row_Num = Row_Num + 1 %>
    <tr>
    <td><% response.write Row_Num %></td>
    <td><%=RS("Item_Desc")%></td>
    <td><%=RS("Item_Price ")%></td>
    <td><%=RS("Item_Qty")%></td>
    <td>SubtotalFuntion</td>
    </tr>


    "Targa" <targa1SPAMSUCKS@alltel.net> wrote in message
    news:eRcETkFSEHA.3708@TK2MSFTNGP10.phx.gbl...
    > I have an asp page which displays database results in a table - (this is
    an
    > invoice page).
    > I have a variable called Row_Num which stores the row ID. Each time I add
    an
    > item, I need the Row_Num var to increment by 1.
    >
    > SELECT Item_Desc,Item_Price FROM Line_Items WHERE OrderNum = 00123
    >
    > Row 1 Item Qty Price Subtotal
    > Row 2 Item Qty Price Subtotal
    > Row 3 Item Qty Price Subtotal
    > Row 4 Item Qty Price Subtotal
    >
    > There is also an option to delete a row so the Row_Num var would need to
    be
    > adjusted - say I deleted Row 2, Row 3 would need to change to Row 2 and
    Row
    > 4 would change to Row 3 in order to keep the correct number of rows.
    >
    > Im stuck on the incrementing part.
    > I think I need a loop to the incrememnting but am not sure how to do it.
    > Any help greatly appreciated.
    >
    > Thanks!
    >
    >
    >

    Targa 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