Listing all number between 2 points

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

  1. #1

    Default Listing all number between 2 points

    Hi

    I have 2 textboxes - from & to.
    Assume I enter number 1 in "from" and "10" in to - I want the ASP to return
    : 1,2,3,4,5,6,7,8,9,10 and insert this into access database over 10 rows
    into the 'number' field.

    Anyone got any ideas how to do this?

    TIA
    Oli


    Oli Guest

  2. Similar Questions and Discussions

    1. File Listing
      Hi there. First of all, sorry for my poor english. I have a problem that I don't know how to resolve. I want to make a dynamic image gallery....
    2. Listing Datasources in MX 6.1
      Anyone know what's up with CFMX 7 and doing this same thing? It's clearly been ripped out and re-done with the new funtionality in the api's......
    3. int Number to text Number Function / UDF ?
      Is there a function that converts e.g. 3 to Three? Probably not but I just thought I'd ask.
    4. Listing
      Hello, I am just working on a text where I need to use listing symbols like in MS Word (dash oder points). But I cannot find anything like that in...
    5. sort from the smallest number to the highest number
      Hi Just say I want to sort the row by using the fifth column data as reference from the smallest the largest number, if using sort, It will give...
  3. #2

    Default Re: Listing all number between 2 points

    Once you submit the form, I suppose you could do this:

    <%
    ' assuming a valid connection object 'conn'
    Nfrom = request.form("from")
    Nto = request.form("to")
    ' I'll assume checks for isnumeric and
    ' valid range, e.g. from <= to
    for i = Nfrom to Nto
    conn.execute("INSERT tbl(number) VALUES(" & i & ")")
    next
    %>

    But, why do you have to *store* the range? Couldn't you produce the numbers
    between the two points at SELECT time? E.g. using the same kind of looping
    logic above. There is no reason to store the entire range across 10 rows
    when there is a consecutive sequence... this just seems wasteful to me.

    In SQL Server you could use a numbers table, and just store the beginning
    and end. You could join on the numbers table so that you don't have to
    store the range.

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]




    "Oli" <oli@NOSPAMoliwoods.co.uk> wrote in message
    news:bqdbdm$5hm$1@hercules.btinternet.com...
    > Hi
    >
    > I have 2 textboxes - from & to.
    > Assume I enter number 1 in "from" and "10" in to - I want the ASP to
    return
    > : 1,2,3,4,5,6,7,8,9,10 and insert this into access database over 10 rows
    > into the 'number' field.
    >
    > Anyone got any ideas how to do this?
    >
    > TIA
    > Oli
    >
    >

    Aaron Bertrand [MVP] 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