This topic is locked

Using Session Var in Edit SQL query window

7/13/2010 11:46:07 AM
ASPRunnerPro General questions
N
nrijo author

Hi,
I created a new view and need to display specific sets of record per userID.
I am trying to put in the following in the Edit SQL query window:
SELECT [Mentor_Main].[mentorID], [LastName], [FirstName], [LifeNumber], [DateStarted], [Mentor_Main].[AccessType], [UserID]

FROM [DOMMentoring].[dbo].[Mentor_Main] INNER JOIN [DOMMentoring].[dbo].[Mentor_Login]

ON [DOMMentoring].[dbo].[Mentor_Main].[AccessType] = [DOMMentoring].[dbo].[Mentor_Login].[AccessType]

WHERE [UserID] = '.SESSION["UserID"].'
This SQL query works at the database level when I replace the Session["user"] with actual userID. But can't get it to work on ASPRunner project.
Thanks
Noel

A
ann 7/14/2010

Noel,
add to the Edit SQL query tab the following query:

SELECT [Mentor_Main].[mentorID], [LastName], [FirstName], [LifeNumber], [DateStarted], [Mentor_Main].[AccessType], [UserID]

FROM [DOMMentoring].[dbo].[Mentor_Main] INNER JOIN [DOMMentoring].[dbo].[Mentor_Login]

ON [DOMMentoring].[dbo].[Mentor_Main].[AccessType] = [DOMMentoring].[dbo].[Mentor_Login].[AccessType]



then add to the Before SQL query event on the Events tab:

strWhereClause=whereAdd(strWhereClause,"UserID='" & SESSION("UserID") & "'")
N
nrijo author 7/15/2010

Ann,
It worked perfectly. I never noticed the Before SQL query Event. Do you guys have an extended User Guide with more detail info on the features? The help file is just too simple.
Thanks,
Noel

A
ann 7/16/2010