08-08-2002, 11:17 AM
i'm using ASP + SQL Server 2000.
i hav a page, i retrieve almost 100 records from database and shown all the record description with 2 textboxes for each records(Total is 200 textboxes) to allow user add value,
when i gonna save the text boxes that with value, do i need to loop 100 times to check the value is empty or not, then only i save into database?
any solution that can reduce the processing time? can i use check box with it?
08-09-2002, 02:14 PM
I would add a checkbox for each record with the same name and let the value be the ID of each row. Then on the server side loop through your checkbox collection and update your db. This way you are only updating the affected records not all 100 of them.
08-09-2002, 04:11 PM
Then on the server side loop through your checkbox collection and update your db.
That's THE problem (for me anyway).
I'm trying to loop through <option>s in a <select> object (no prob. looping through them) and stuff them into a database. I can't seem to make it happen. I'm calling a stored procedure. Do I use "recordset.execute" or "recordset.update" or outside the loop use "recordset.updatebatch?" And HOW? I do not understand enough about the interaction/complimentary nature of connection, command, recordset objects to make it work. And I guess that's what N.T. is asking about. I'm using a connection and recordset (no command). Why? Hell, I don't know!
Oh, and BTW, N.T. ;
request.form("checkbox_group_name").count will give you the # of checkboxes so u can use that as the terminator for your loop on the server-side.
Also use request.form("checkbox_group_name")(x) to reference each checkbox inside the loop on the server-side.
Also, note that ONLY the checkboxes that are "checked" are actually passed when SUBMITted. So my SUBMIT button calls a function that "checks" all the checkboxes (i.e formname.chkboxname[x].checked = true). It's the checkbox's value property that actually carries the info for me that goes into the database.
08-09-2002, 05:07 PM
This is how I loop through my checkboxes to update my db.
Request.Form("hdnID") is my collection of checked checkboxes.
tskID = split(Request.Form("hdnID"), ",")
For Each id in tskID
rs("Desc") = Request.Form("txtDesc")
As far as the stored procedures I would have to see more code. I do not get to work with them much :mad: