I have two tables
Project master Table::
proid ProjectName ProjectManager IsDeleted
1 c# Mr.A N
2 sql Mr.B N
3 asp.net Mr.c N
4 java Mr.A N
5 php Mr.B N
6 Linq Mr.c N
User Master Table:
Userid UserName Designation
1 Mr.A Project Manager
2 Mr.B Project Manager
3 Mr.C Project Manager
4 XXX Reviewer.
I want to bind a combo box in this way if Mr.A logs in he should get a combobox binded with projects he tagged in.., If reviewer logs in he should get all projects name...,I want to write a query for this scenario using If Else condition....,
Need a help..., Thanks in advance...,
Loading
Bryian TanPosted Dec 9, 2012, 8:30 PM
You can try something like
@UserName VARCHAR(50)
SET @designation = 'Project Manager'
SET @UserName = 'Mr.C'
IF @designation = 'Project Manager'
BEGIN
SELECT proid, ProjectName FROM dbo.ProjectMaster
WHERE ProjectManager = @UserName and isDeleted='N'
END
ELSE
BEGIN
SELECT proid, ProjectName FROM dbo.ProjectMaster WHERE isDeleted='N'
END
I would also suggest to use UserID in the ProjectManager Column and Boolean type for isDeleted column