Forum Moderators: open

Message Too Old, No Replies

Looping insert/delete with ASP

         

engine

4:13 pm on Oct 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I am trying to create a record insert page using asp/vbscript/access/Dreamweaver

I have an access database with 3 tables: "People", "Services" and "Offered" which is related to both.

Offered is used to record who offers which services.

I need to build an insert record form that lists all the services (a repeat region built from the services table) as check boxes. This will need to insert multiple records on submit so each service ID is record against the persons id already establish as a passed variable in a query string.

I understand I need some sort of looping statement that handles the inserts but, my meagre coding skills (note. I use Dreamweaver!) can't handle this. I cannot seem to find any tips via Google either.

Any help would be appreciated.

txbakers

9:40 pm on Oct 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here is what my code looks like to do this:

if (String(Request("upd"))!= "undefined") {
var Cmd = Server.CreateObject('ADODB.Command');
Cmd.ActiveConnection = connForms;
for ( j = 1; j <= frmcnt; j++ ) {
var joe = (Request("seq"+j) == "")?0:Request("seq"+j);
var sql = "update form4list set seq=" + joe + " where rrn=" + Request("rn" + j);
Cmd.CommandText = sql;
Cmd.Execute();
} // for loop
Cmd.ActiveConnection.Close();
Cmd = null;
Response.Redirect("schedule.asp");
}

You need to now how many loops to make, I set some variables to accept the Request values, and make the SQL dynamic.