I am working with asp.NET and C# with an access database to create a web application.
My current issue is with an SQL statement. In the project i have already successfully used a string value to build and store a query. Because it is stored in a string it is a bit ugly to look at. The problem is with this last query i am writing. It has 2 inner joins in it and i am unsure what exactly is wrong. The error i get is a syntax error (missing operator) and it then lists everything inside the parenthesis. Here is the query:
SELECT Employee.[First Name], Employee.[Last Name], Employee.[Email],
Departments.[Department]
FROM (
Employee INNER JOIN EmpDept ON Employee.[EmpUserName] = EmpDept.[EmpUserName]
INNER JOIN Departments ON Departments.[Department Number] = '2'
)
WHERE Departments.[Campus]='Clarion';
It is very ugly like this, i know.. Im hoping that since this is a syntax error it wont be too hard.
This query is designed to return the name, email, and department of an employee. The 2 is given with c# code and is determined earlier in the code, but it stands for a certain department. The empDept table goes between the Departments table and the employee table so an employee can be in more than one department.
Any help is greatly appreciated. Thanks
The 2 is given with c# codeThe way you phrased this makes it sound like you have an sql injection vulernability. This is not okay, and closing that hole should be priority number 1.