Rowcount of a table

Discussion in 'ASP General' started by HoustonLucifer, Jun 30, 2004.

  1. Hi all, i have two questions

    1) I have an asp page where the user clicks on an add button which adds rows
    to the HTML table. When the user clicks on the submit button the same form
    is posted again. How do i know how many rows the user added to the table. I
    can get it in the script tag but i need to do this in the <%%> tag. I have
    to get these values and insert into the database. All the controls created
    dynamically are named volume1, volume2 etc.,

    2) Since i have to go through the loop and insert the rows from the table
    mentioned above, is there any way to write a generic insert statement. The
    below code shows what i am trying to do.

    volume1 = Request.Form("volume1text")
    volume2 = Request.Form("volume2text")
    volume3 = Request.Form("volume3text")

    For i = 1 to 3
    If i = 1 Then
    "Insert into table values (" & volume1 & ")"
    Elseif i = 2 Then
    "Insert into table values (" & volume2 & ")"
    Else
    "Insert into table values (" & volume3 & ")"
    Next

    What i want to do is write something like the following. How can i do this.
    The following variablr volInsert is being treated as string. Volume is a
    text field.

    For i = 1 to 3
    volInsert = "volume" & i
    "Insert into table values ('" & volInsert & "')"
    Next

    Thanks
    HoustonLucifer, Jun 30, 2004
    #1
    1. Advertising

  2. HoustonLucifer

    Steven Burn Guest

    When the user clicks the submit button to create the row's, are you passing
    the rows to create, to a querystring? if not, give that a try (works for
    me).

    --

    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!


    "HoustonLucifer" <> wrote in message
    news:buHEc.10348$...
    > Hi all, i have two questions
    >
    > 1) I have an asp page where the user clicks on an add button which adds

    rows
    > to the HTML table. When the user clicks on the submit button the same form
    > is posted again. How do i know how many rows the user added to the table.

    I
    > can get it in the script tag but i need to do this in the <%%> tag. I have
    > to get these values and insert into the database. All the controls created
    > dynamically are named volume1, volume2 etc.,
    >
    > 2) Since i have to go through the loop and insert the rows from the table
    > mentioned above, is there any way to write a generic insert statement. The
    > below code shows what i am trying to do.
    >
    > volume1 = Request.Form("volume1text")
    > volume2 = Request.Form("volume2text")
    > volume3 = Request.Form("volume3text")
    >
    > For i = 1 to 3
    > If i = 1 Then
    > "Insert into table values (" & volume1 & ")"
    > Elseif i = 2 Then
    > "Insert into table values (" & volume2 & ")"
    > Else
    > "Insert into table values (" & volume3 & ")"
    > Next
    >
    > What i want to do is write something like the following. How can i do

    this.
    > The following variablr volInsert is being treated as string. Volume is a
    > text field.
    >
    > For i = 1 to 3
    > volInsert = "volume" & i
    > "Insert into table values ('" & volInsert & "')"
    > Next
    >
    > Thanks
    >
    >
    Steven Burn, Jul 1, 2004
    #2
    1. Advertising

  3. Actually i use the VB Script to add the rows in the table

    <script>
    Set row = form1.Table1.InsertRow()
    Set cell = row.InsertCell()
    </script>

    "Steven Burn" <> wrote in message
    news:...
    > When the user clicks the submit button to create the row's, are you

    passing
    > the rows to create, to a querystring? if not, give that a try (works for
    > me).
    >
    > --
    >
    > Regards
    >
    > Steven Burn
    > Ur I.T. Mate Group
    > www.it-mate.co.uk
    >
    > Keeping it FREE!
    >
    >
    > "HoustonLucifer" <> wrote in message
    > news:buHEc.10348$...
    > > Hi all, i have two questions
    > >
    > > 1) I have an asp page where the user clicks on an add button which adds

    > rows
    > > to the HTML table. When the user clicks on the submit button the same

    form
    > > is posted again. How do i know how many rows the user added to the

    table.
    > I
    > > can get it in the script tag but i need to do this in the <%%> tag. I

    have
    > > to get these values and insert into the database. All the controls

    created
    > > dynamically are named volume1, volume2 etc.,
    > >
    > > 2) Since i have to go through the loop and insert the rows from the

    table
    > > mentioned above, is there any way to write a generic insert statement.

    The
    > > below code shows what i am trying to do.
    > >
    > > volume1 = Request.Form("volume1text")
    > > volume2 = Request.Form("volume2text")
    > > volume3 = Request.Form("volume3text")
    > >
    > > For i = 1 to 3
    > > If i = 1 Then
    > > "Insert into table values (" & volume1 & ")"
    > > Elseif i = 2 Then
    > > "Insert into table values (" & volume2 & ")"
    > > Else
    > > "Insert into table values (" & volume3 & ")"
    > > Next
    > >
    > > What i want to do is write something like the following. How can i do

    > this.
    > > The following variablr volInsert is being treated as string. Volume is a
    > > text field.
    > >
    > > For i = 1 to 3
    > > volInsert = "volume" & i
    > > "Insert into table values ('" & volInsert & "')"
    > > Next
    > >
    > > Thanks
    > >
    > >

    >
    >
    HoustonLucifer, Jul 1, 2004
    #3
  4. > Actually i use the VB Script to add the rows in the table
    >
    > <script>
    > Set row = form1.Table1.InsertRow()
    > Set cell = row.InsertCell()
    > </script>


    THis is on the clientside? So have a counter. Every time you call
    InsertRow(), add 1 to the counter. WHat does this have to do with ASP
    again?
    Aaron [SQL Server MVP], Jul 1, 2004
    #4
    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. robert madrian

    ODS + TableAdapter + Rowcount

    robert madrian, Dec 19, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    394
    robert madrian
    Dec 19, 2005
  2. Replies:
    1
    Views:
    287
    =?ISO-8859-1?Q?Gerhard_H=E4ring?=
    Nov 14, 2005
  3. Jon Haakon Ariansen

    SqlDataReader - ReturnValue - rowcount

    Jon Haakon Ariansen, Nov 8, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    1,932
    bruce barker \(sqlwork.com\)
    Nov 8, 2006
  4. segue

    getting rowcount

    segue, Jan 23, 2008, in forum: ASP .Net
    Replies:
    4
    Views:
    765
    segue
    Jan 23, 2008
  5. Dev
    Replies:
    3
    Views:
    911
Loading...

Share This Page