Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get session variable in SQL query

Status
Not open for further replies.

kwilsokl

MIS
Apr 21, 2005
15
US
I have an access database and it also is used for some asp pages. There is a login page that was auto generated that create a session variable based on the login, again all set auto generated by the program.

I want to create a reports page for users but have it pass their user id in the SQL query as a parameter and display records or queries where it matches their userid.

But I don’t know what I am doing. I used a simple ASP program to create the asp pages which also created the login pages which references a login table in the access database.


How do capture the login session and base the query on the logged in user.
below is an example of my SQL query that has the user hard coded in it.

SELECT tblParolee.ParoleeID, tblParolee.LastName, tblParolee.FirstName, tblParolee.CareCoordinators, tblCaseNotes.ContactDate
FROM tblParolee LEFT JOIN tblCaseNotes ON tblParolee.ParoleeID = tblCaseNotes.ParoleeID
GROUP BY tblParolee.ParoleeID, tblParolee.LastName, tblParolee.FirstName, tblParolee.CareCoordinators, tblCaseNotes.ContactDate, Month([ContactDate])
HAVING (((tblParolee.CareCoordinators)="Craig Judd-ICS") AND ((Month([ContactDate]))=Month(Now())));
 
You should ask this in the ASP forum forum333

Also, that is an access query, so if you have any troubles with your database please ask in one of the access forums.

Basically, you will want to insert the value of your session variable while building your SQL string.

Good Luck,

Alex

[small]----signature below----[/small]
I don't do any programming whatsoever

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top