Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Update Multiple Records with One submit

Reply
Thread Tools

Update Multiple Records with One submit

 
 
Olivia Towery
Guest
Posts: n/a
 
      08-14-2003
SQL 6.5 Database

I have a list of registrants and I want to use a check box after each record
to show those who attend and then post all with one submit button.

Any help is appreciated.

--
Olivia Towery
Tower Internet Management


 
Reply With Quote
 
 
 
 
Tom B
Guest
Posts: n/a
 
      08-14-2003
You can loop through your results, and send an update for each one. Do you
need to update those who don't attend?

I'll assume you don't have to update those who don't.

So on your form you'd have.....

Joe Blow <input type=checkbox name=ATTENDED value=1>
Fred Smith <input type=checkbox name=ATTENDED value=8>
Jen Jones <input type=checkbox name=ATTENDED value=3>
Gerald Springer<input type=checkbox name=ATTENDED value=99>

(Note that the value is the registrants ID from the database)

When the page is submitted the value of Request.Form("ATTENDED") will be a
comma delimited string of the selected values, so assuming just Joe, Jen and
Gerald are checked then it would equal "1,8,99" So, split it into an array
and update the database


Dim arrRegistrants
Dim iLoop
Dim sSQL
arrRegistrants=Split(Request.Form("ATTENDED"),",")

for iLoop=0 to Ubound(arrRegistrants)
sSQL="UPDATE tblWhatever Set Attended=1 WHERE RegistrantID=" &
arrRegistrants(iLoop)
CN.Execute sSQL 'Assuming CN is a valid and open connection object
next


You could also send a single sql statement along the lines of

sSQL="UPDATE tblWhatever SET Attended=1 WHERE RegistrantID IN (" &
Request.Form("ATTENDED") & ")"

which would look like this
UPDATE tblWhatever SET Attended=1 WHERE RegistrantID IN (1,8,99)

I think that's right, check BOL.




"Olivia Towery" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> SQL 6.5 Database
>
> I have a list of registrants and I want to use a check box after each

record
> to show those who attend and then post all with one submit button.
>
> Any help is appreciated.
>
> --
> Olivia Towery
> Tower Internet Management
>
>



 
Reply With Quote
 
 
 
 
Olivia Towery
Guest
Posts: n/a
 
      08-14-2003
Thanks Tom. But what if I do want to be able to uncheck a box and have the
db updated? Can this be done?

"Tom B" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> You can loop through your results, and send an update for each one. Do

you
> need to update those who don't attend?
>
> I'll assume you don't have to update those who don't.
>
> So on your form you'd have.....
>
> Joe Blow <input type=checkbox name=ATTENDED value=1>
> Fred Smith <input type=checkbox name=ATTENDED value=8>
> Jen Jones <input type=checkbox name=ATTENDED value=3>
> Gerald Springer<input type=checkbox name=ATTENDED value=99>
>
> (Note that the value is the registrants ID from the database)
>
> When the page is submitted the value of Request.Form("ATTENDED") will be a
> comma delimited string of the selected values, so assuming just Joe, Jen

and
> Gerald are checked then it would equal "1,8,99" So, split it into an array
> and update the database
>
>
> Dim arrRegistrants
> Dim iLoop
> Dim sSQL
> arrRegistrants=Split(Request.Form("ATTENDED"),",")
>
> for iLoop=0 to Ubound(arrRegistrants)
> sSQL="UPDATE tblWhatever Set Attended=1 WHERE RegistrantID=" &
> arrRegistrants(iLoop)
> CN.Execute sSQL 'Assuming CN is a valid and open connection object
> next
>
>
> You could also send a single sql statement along the lines of
>
> sSQL="UPDATE tblWhatever SET Attended=1 WHERE RegistrantID IN (" &
> Request.Form("ATTENDED") & ")"
>
> which would look like this
> UPDATE tblWhatever SET Attended=1 WHERE RegistrantID IN (1,8,99)
>
> I think that's right, check BOL.
>
>
>
>
> "Olivia Towery" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > SQL 6.5 Database
> >
> > I have a list of registrants and I want to use a check box after each

> record
> > to show those who attend and then post all with one submit button.
> >
> > Any help is appreciated.
> >
> > --
> > Olivia Towery
> > Tower Internet Management
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Struts/JSP - How would one view multiple database records over severalpages instead of one? Geoff Winsor Java 3 01-29-2005 03:31 AM
Populating multiple textboxes with multiple records for update page Drew ASP General 7 11-10-2004 02:21 PM
any good idea about Update many records in one page, one batch Edward ASP .Net 1 06-10-2004 09:30 AM
Submit Form Elements to Insert Multiple Records into a Database Sans Spam ASP General 8 05-24-2004 09:16 PM
Delete records or update records Dan ASP General 1 05-10-2004 01:25 PM



Advertisments