Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Tim Pollard #1
Can you put an Insert Command object in a loop?
Hi
I am trying to figure out how to insert a variable number of records
into one table in Access, therefore without stored procedures, in ASP
VBScript.
My application includes the facility for the user to search the
database of contacts for people matching certain criteria to send a
mailing to. The search form leads to a second form which contains a
repeat region displaying the list of records that match the chosen
criteria. The user can then deselect people he/she doesn't want to
send to using a check box. Consequently there could be one or hundreds
in the mailing list. My second form currently submits all checked
personIDs into one field in the mailing list table (because all
instances of the checkbox in the repeat region have the same name).
This works but is clearly not ideal - you later have to parse this
field in order to get any useful data out of it.
What I'd really like to do is get each person checked into its own
line in the db.
ie. Current structure:
ListID Mailinglist
1 2, 5, 88
2 7, 14, 102
Where each comma delimeted value in field MailingList represents one
PersonID
Ideal structure:
ListID PersonID
1 2
1 5
1 88
2 7
2 14
2 102
Easy enough with SQL Server, but horrible with Access.
If you know the number of records to insert you can do it with a
command insert object, but this is really only practical with fairly
short lists - i.e. if you always want to insert (say) five records it
is OK.
So can you put the command insert object in a variable length loop and
keep iterating through it until you reach the total checked
recordcount?
My hand coding skills aren't much to write home about, so any guidance
much appreciated.
Thanks
TimP
Tim Pollard Guest
-
What's faster - loop for insert or insert...select.
What is faster if I'm moving large numbers of records (anywhere from 10,000 to 300,000 records per archive) from one query to another table? 1)... -
Insert Loop values into DB Problem
:confused; How do I call the loop when inserting the values into my DB? I am getting an error message. Here is the Insert Statement: ... -
insert record loop
Can anyone help me to create an insert record loop using asp vbs? -
Film loop not allowing my rollover command to work
I ve created a menu bar of buttons that all have rollovrs, sond fx, and jump to marker command. I'm embedding all the buttons into a film loop to... -
How to select and then loop while insert
I need help in writing a stored procedure on SQL Server 2000. Basically the stored procedure's primary task is to generate invoice records and...



Reply With Quote

