Rowcount of a table

H

HoustonLucifer

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
 
S

Steven Burn

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!
 
H

HoustonLucifer

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

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

Aaron [SQL Server MVP]

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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top