473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Update Multiple Records with One submit

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
Jul 19 '05 #1
2 10336
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" <pr*****@timwebs.com> wrote in message
news:us**************@TK2MSFTNGP09.phx.gbl...
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

Jul 19 '05 #2
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" <sh*****@hotmail.com> wrote in message
news:OB**************@TK2MSFTNGP12.phx.gbl...
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" <pr*****@timwebs.com> wrote in message
news:us**************@TK2MSFTNGP09.phx.gbl...
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


Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old...
4
by: shank | last post by:
Visually, the page will look somewhat like a spreadsheet. It could have hundreds of records (rows) displayed. I want to enable the user to edit any one or any number of records and any fields, then...
7
by: Drew | last post by:
I have a db table like the following, UID, int auto-increment RegNo Person Relation YearsKnown Now here is some sample data from this table,
5
by: A.Dagostino | last post by:
hi i need to update an SQL Table when user select or unselect a checkbox control. How Can i do? Thanks Alex
3
by: pmud | last post by:
Hi, I have an ASP.NET application using C# code. I am using a datagrid to display records from a database based on a user input, i.e a user enters a compnay name in text box & when he clicks a...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
1
by: Jack | last post by:
Hi, I got a test asp page which connects to Northwind.mdb database. This page pulls all the rows from the Customers table. One column i.e. GoodStatus has been added to the customers table. The...
6
by: cj | last post by:
I have to take all records in a SQL db that have an empty val_code field and process and update the records with a code number in the val_code field. The processing is done by sending select info...
1
by: teenagelcruise | last post by:
hi, i have a problem with my code which is i cannot update and addnew data into the database but i can delete the data.plz give me an idea.this is my code that i wrote. <html> <head> <meta...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.