...pen SQL, MyConn, 0, 1, adCmdText
CheckedList.asp
AS part of the initial requirements analysis which was drafted, we decided that the companies should be able to delete jobs which have been filled as a batch as opposed to individually. We felt that the best way to do this was to list all jobs offered by the company in a table but to include a column made up of check boxes. The idea is that the company checks the box for each job it wants to delete. The result is a comma delimited list which can be used in a DELETE IN SQL statement. The list is achieved by the following statements.
SQL = "SELECT Job_id, Comp_id, Salary, Location, Type, Category, Date_Added FROM Job WHERE Comp_id=" &request("comp_id")
Response.write"
"
As we can see the value of the checkbox is set to the unique job_id. We can see how this is processed by the next asp file.
DeleteChecked.asp
This is the file which actually executes the deletion of the boxes checked in the checkedlist file. Firstly it requests ‘Delete’ from the calling form. This variable ‘Delete’ is in the form of a comma delimited string of unique job_ids.
strDeleteList = Request("Delete")
the code then makes sure that at the list is not empty and if it is not, deletes the jobs from the jobs table where the id of a job appears in the delete list.
if strDeleteList = "" then
'No items to delete
Response.Write "You did not select any items to delete!"
Else
SQL = "DELETE * FROM Job WHERE Job_id In ("&strDeleteList&")"
MyConn.Execute(SQL)
CompHome.asp
This is the page that a user is directed to after successfully logging in using a valid company contact username and password. It essentially contains an image map which links to the various asp pages which carry out all the functions available to the company. We decided that to add a personal touch to the site, that the registered user should be welcomed by name.
response.write("
Welcome, "&request("user_name")& "
")
When linking to the various functions available to a company, the code passes the comp_id variable to the URL. This variable is then used by the referenced page to carry out queries and data manipulations