|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
deleting from database using checkboxes
I have a MS Access Database. I have a page where i do a search for a item by date, I select a date and then all the information from the database that i requested appears.
From all the information that appears I want to be able to tick the ones that I want to delete or a select all button and click delete and all the ones that where ticked will be deleted from the database. Any help will be greatly appreciated. -Tom |
|
#2
|
||||
|
||||
|
u could use javascript for the checking all or one checkbox here
http://javascript.internet.com and as for the asp code one checkboes.. here's a tutorial abt checkbosxes that i found useful http://www.asp101.com/samples/checkbox.asp hope it helps |
|
#3
|
|||
|
|||
|
Give this a shot.
When you print the checkboxes out to the screen, give them the value of the primary key of that row. have the page submit to itself. If all is checked, delete * from database. otherwise, do a loop through each of the checkboxes, if it's checked, then add that line into the delete SQL statement |
|
#4
|
|||
|
|||
|
Either hardcode the checkbox variables so that when you want to delete the email address for instance, by clicking the checkbox the variable is the access field name. i.e. the checkbox variable is email and the field name inside Access iis also email, then use this variable in your SQL query. This is best if its just a particular field in a recordset that you want to delete.
If you want to delete an entire record, give each checkbox the unique ID that relates to that record. Then when you check the box the variable that you catch in the response.querystring or response.form will relate to that record. Both ways are essentially the same but one assigns the field variable and the other the unique ID for that record. I'm not sure whether you want to delete *some* of a particular records data i.e. delete the email address but keep the users details or whether you are trying to delete the entire record Hope this helps and that i haven't just confused you even more.
__________________
Thanks in advance Chris |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > deleting from database using checkboxes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|