"SELECT tbl_vacancies.job_id, tbl_vacancies.job_name, " +
"tbl_vacancies.location, tbl_vacancies.voucher, tbl_vacancies.details, " +
"tbl_vacancies.availability, tbl_vacancies.region, " +
"(SELECT COUNT(*) FROM tbl_applications WHERE tbl_applications.ID = tbl_vacancies.job_id and viewed = 0) AS VIEWED " +
"FROM tbl_vacancies WHERE tbl_vacancies.availability = '" + DropDownList1.SelectedValue + "' AND (tbl_vacancies.location like '%" + txt_search.Text +
"%') OR (tbl_vacancies.job_name like '%" + txt_search.Text + "%') ORDER BY tbl_vacancies.location ASC"
I understand that i should be using paraterized queries, i will apply this once i get the query working. BUt the query above is not working. If i use this:
"SELECT tbl_vacancies.job_id, tbl_vacancies.job_name, " +
"tbl_vacancies.location, tbl_vacancies.voucher, tbl_vacancies.details, " +
"tbl_vacancies.availability, tbl_vacancies.region, " +
"(SELECT COUNT(*) FROM tbl_applications WHERE tbl_applications.ID = tbl_vacancies.job_id and viewed = 0) AS VIEWED " +
"FROM tbl_vacancies WHERE tbl_vacancies.availability = '" + DropDownList1.SelectedValue + "' ORDER BY tbl_vacancies.location ASC"