Insert Multiple Records
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=7127
Printed Date: 31 March 2026 at 4:31pm Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: Insert Multiple Records
Posted By: ngaisteve1
Subject: Insert Multiple Records
Date Posted: 09 November 2003 at 9:52pm
I wonder I ask this before. But, the problem I am facing right now is insert / save multiple records. (View - http://www.htmlforums.com/attachment.php?s=&postid=196633 - http://www.htmlforums.com/attachment.php?s=&postid=19663 3 ). I don't any problem to delete multiple records. For deletion multiple records, I use the checkbox and then the process file, I use Select IN. But, for insert / save multiple records, the problem I thought of is the field name. The quantity textbox name is not fix (dynamic). And these dynamic textbox name is going to save to that id. I got stuck here. I have done a little research. Most of them is update multile not insert multiple. I guess update multiple is a litte easier because the number of records is fix, thus make the for loop easier.
Any idea to my problems? Any good tutorial or sample regarding this situation? Thank you everyone in advance.
|
Replies:
Posted By: ljamal
Date Posted: 10 November 2003 at 7:47am
To do an insert multiple, you need a force the user into a set number and/or let them pick a set number. (see the poll creation in this forum)
Then you create a form with all the fields for each record. I usually name things logically so if I have 7 rows of 3 columns, they would be 1-1, 1-2, 1-3, 2-1, 2-3, 2-4, etc.
Since you know how many rows are supposed to have you can loop through and get the information and create a insert statement for each row of data.
------------- L. Jamal Walton
http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming
|
Posted By: ngaisteve1
Date Posted: 10 November 2003 at 6:18pm
|
But, what u mean would be a fix loop or dynamic loop? Means, if fix loop, if got ten records, I fill in 3, the process file will loop ten records. While dynamic loop is, if got ten records, I fill in 3, it will loop 3 only.
|
Posted By: ljamal
Date Posted: 10 November 2003 at 6:24pm
What I suggested is a dynamic fixed loop, if that makes any sense. It's dynamic in that the user decides the # of rows, but fixed in that you know how many rows to display on the page and look for later.
A truly dynamic solution could allow you to add one at a time until you are finished or even multiple at a time until you are finished.
------------- L. Jamal Walton
http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming
|
Posted By: ngaisteve1
Date Posted: 10 November 2003 at 6:45pm
|
Hmm ... now I think I get what you meant. Thanks.
|
|