1

I am using sql server 2005. In this query i want the log-in user detail should also display but it is not displaying . So please modify the query so that log-in user detail should also display with the help of session[userId].tostring();

Query written by me is:

SELECT DISTINCT MUDMEMBER.PK_ID, MUDMEMBER.EMPLOYEE_ID, LKB.BANK_NAME, MUHD.SALARY_ACCOUNT_NO, MUHD.PF_NO,
 MUHD.PAN_NO, MUHD.GENDER, LKD.DESIGNATION_NAME FROM M_LEADERLED MLL INNER JOIN M_USER_DETAILS MUDMEMBER ON 
 MLL.LED_ID = MUDMEMBER.PK_ID AND MLL.START_DATE <= Getdate() AND MLL.END_DATE > Getdate()  AND MLL.LEADER_ID = '1' LEFT OUTER JOIN 
   M_USER_HR_DETAILS MUHD ON MUHD.FK_USER_ID = MUDMEMBER.PK_ID AND MUHD.IS_ACTIVE =1 LEFT OUTER JOIN
    LK_BANKS LKB ON LKB.PK_ID = MUHD.FK_BANK_ID LEFT OUTER JOIN LK_DESIGNATION LKD ON
     LKD.DESIGNATION_VALUE = MUHD.FK_DESIGNATION_VALUE AND LKD.FK_ORGANIZATION_ID = 1 AND LKD.IS_ACTIVE = 1 WHERE MUDMEMBER.ACTIVE = 1
5
  • Can you give more details? like what columns do you want to display and where do you want to use session[userid]? Commented Oct 14, 2010 at 12:18
  • @Shalni: where are you writing this query, in ASP.net page or in Storeprocedure Commented Oct 14, 2010 at 12:22
  • The column i want to displaying is given above .I only want to add one more row of log-in user with same above column . Like: PK_ID=session[userid].Tostring() Commented Oct 14, 2010 at 12:22
  • @ Vijjendra : in asp.net page Commented Oct 14, 2010 at 12:23
  • God help us if this is actually being used in any kind of banking software...If you want an answer, you have to ask a more detailed question. People aren't going to keep guessing what you actually need. Commented Oct 14, 2010 at 13:39

1 Answer 1

2

ASP.Net Page you can fetch the loggedin user's detail as follows:

SELECT DISTINCT MUDMEMBER.PK_ID, MUDMEMBER.EMPLOYEE_ID, LKB.BANK_NAME, MUHD.SALARY_ACCOUNT_NO, MUHD.PF_NO, MUHD.PAN_NO, MUHD.GENDER, LKD.DESIGNATION_NAME FROM M_LEADERLED MLL INNER JOIN M_USER_DETAILS MUDMEMBER ON MLL.LED_ID = MUDMEMBER.PK_ID AND MLL.START_DATE <= Getdate() AND MLL.END_DATE > Getdate()
AND MLL.LEADER_ID = '1' LEFT OUTER JOIN M_USER_HR_DETAILS MUHD ON MUHD.FK_USER_ID = MUDMEMBER.PK_ID AND MUHD.IS_ACTIVE =1 LEFT OUTER JOIN LK_BANKS LKB ON LKB.PK_ID = MUHD.FK_BANK_ID LEFT OUTER JOIN LK_DESIGNATION LKD ON LKD.DESIGNATION_VALUE = MUHD.FK_DESIGNATION_VALUE AND LKD.FK_ORGANIZATION_ID = 1 AND LKD.IS_ACTIVE = 1 WHERE MUDMEMBER.ACTIVE = 1 AND MUDMEMBER.PK_ID ="+Convert.ToInt32(Session["UserId"])+"

Sign up to request clarification or add additional context in comments.

2 Comments

Sorry sir, It only display one row of log-in user id ,rest of the row will not displayed.
@Shalini:can you explain in detail what you exactly want

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.