Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Rowcount of a table

Reply
Thread Tools

Rowcount of a table

 
 
HoustonLucifer
Guest
Posts: n/a
 
      06-30-2004
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


 
Reply With Quote
 
 
 
 
Steven Burn
Guest
Posts: n/a
 
      06-30-2004
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" <(E-Mail Removed)> wrote in message
news:buHEc.10348$(E-Mail Removed) om...
> 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
>
>



 
Reply With Quote
 
 
 
 
HoustonLucifer
Guest
Posts: n/a
 
      06-30-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:buHEc.10348$(E-Mail Removed) om...
> > 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
> >
> >

>
>



 
Reply With Quote
 
Aaron [SQL Server MVP]
Guest
Posts: n/a
 
      07-01-2004
> 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?


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting rowcount segue ASP .Net 4 01-23-2008 09:42 PM
Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview Dev ASP .Net Datagrid Control 3 05-09-2007 11:50 AM
SqlDataReader - ReturnValue - rowcount Jon Haakon Ariansen ASP .Net 3 11-08-2006 04:35 PM
ODS + TableAdapter + Rowcount robert madrian ASP .Net 0 12-19-2005 05:45 PM
DB API specification of .rowcount and/or execute andychambers2002@yahoo.co.uk Python 1 11-14-2005 03:41 PM



Advertisments