Ask a Question related to Dreamweaver AppDev, Design and Development.
-
DiscoZed #1
One Form, Mutiple Inserts, Multiple Records
I am attempting to create a form which allows multiple record inserts. This
will be used to add classes by participant to a training database. The page is
created with a repeating region - a checkbox to indicate attendance and hidden
fields with the class name and date.
I would like it to create a unique record for each person (indicated by the
checkbox). I can find no documentation for this anywhere and have attempted to
alter the "multiple update form documentation" for the use of inserting. That
has not worked.
Some code is attached. I have asp fields within the form that create a unique
number for each repeated item and then counts the total number of records.
Any help would be very appreciated!
<%If Request.Form("Submit").Count > 0 Then
Dim iCount, iLoop, varUsername, varDate, varClassName
icount = Request("fldAdd").Count 'iCount is number of records to be updated
set cmdInsert = Server.CreateObject("ADODB.Command")
cmdInsert.ActiveConnection = MM_connDirectorySQL_STRING
For iLoop = 1 to iCount
if(Request.Form(iLoop & ".fldAdd") <> "") Then
if(Request.Form(iLoop & ".fldAdd") <> "") Then cmdInsert_varUsername =
Request(iLoop & ".fldUsername")
if(Request.Form(iLoop & ".fldAdd") <> "") Then cmdInsert_varDate =
Request(iLoop & ".fldDate")
if(Request.Form(iLoop & ".fldAdd") <> "") Then cmdInsert_varClassName =
Request(iLoop & ".fldClassName")
cmdInsert.CommandText = "INSERT INTO dbo.tblClasses (fldUserName, fldDate,
fldClassName) VALUES (('" + Replace(cmdInsert__varUsername, "'", "''") + "','"
+ Replace(cmdInsert__varDate, "'", "''") + "','" +
Replace(cmdInsert__varClassName, "'", "''") + "') WHERE '" +
Replace(cmdInsert__varAdd, "'", "''") + "' <> "") "
cmdInsert.CommandType = 1
cmdInsert.CommandTimeout = 0
cmdInsert.Prepared = true
cmdInsert.Execute()
End If
Next
set cmdInsert = Nothing
Response.Redirect("trainerchoose.asp")
End If
%>
DiscoZed Guest
-
Insert Multiple form records into DB
I have a form that populates with data from several queries and calcs, it creates about 70 rows of form data. I need for the form fields to be... -
update multiple records in multiple tables from one form
hello I have been trying to run multiple update queries based on the data entered by user. Brief background: I am fetching data from various... -
display multiple records from db on one pdf form
hi all, I am looking for help in displaying all records in the dababase on just one pdf form, no buttons needed. I want the form to be populated... -
Can I have a form that inserts multiple data
I am rather new to Access and am trying to create a subfom. This subform is based on a table and I would like to be able to select multiple lines... -
Entering multiple records with one form
Hello, I am trying to setup a single form that will enter several records into a table at once. Does anyone have a hint as to how this might be...



Reply With Quote

