Reading values from multiple "similar" controls

Discussion in 'ASP .Net' started by Bijoy Naick, May 4, 2004.

  1. Bijoy Naick

    Bijoy Naick Guest

    I have a form with mutiple text fields, all of similar nature.. for
    example:

    userName1, location1
    userName2, location2
    ..
    ..
    ..
    userName10, location10

    all are text fields. while reading the input and saving to a database,
    I'd like to be able to read all of them in a single loop and issue the
    appropriate SQL commands. In ASP 3.0 I can do the following:

    for i = 1 to 10
    sql = "INSERT into TABLE VALUES ('" & Request.Form("userName" & count)
    & "','" & Request.Form("location" & count) & "')"
    execute sql stmt
    next

    How would i go about doing this in ASP.NET? I am not using the Request
    object. I am using an event trigger (button clicked) to gather the info
    and save to a database.

    Bijoy

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Bijoy Naick, May 4, 2004
    #1
    1. Advertising

  2. Request.Form collection

    > for i = 1 to 10
    > sql = "INSERT into TABLE VALUES ('" & Request.Form("userName" & count)
    > & "','" & Request.Form("location" & count) & "')"
    > execute sql stmt
    > next
    >


    Your classic ASP implementation will work for ASP.NET. (Most likely you
    will need to modify the syntax a bit)

    --
    Peter O'Reilly
    Peter O'Reilly, May 4, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. robertm
    Replies:
    1
    Views:
    285
    Dino Chiesa [MSFT]
    Aug 12, 2003
  2. Shabs
    Replies:
    0
    Views:
    918
    Shabs
    Jul 28, 2004
  3. Milo Thurston

    Index of multiple similar strings

    Milo Thurston, Oct 7, 2004, in forum: Ruby
    Replies:
    11
    Views:
    203
    Robert Klemme
    Oct 7, 2004
  4. Replies:
    4
    Views:
    85
  5. Lars Olsson
    Replies:
    3
    Views:
    81
    Ehsanul Hoque
    Sep 22, 2009
Loading...

Share This Page