April 20, 2009 at 4:00 am
Hi
i am a newbie my problem is in my db there are 10 registered usernames wen one of the user logged in to my site i want to display his information i am using ms sql db pls tell me how to give a select query at run time wen a user logged in for this with examples
April 20, 2009 at 4:59 am
Hi
Could you provide some more detail such as what information are you wanting to return about the user & what application are you using e.g are you using reporting services.
April 20, 2009 at 5:07 am
Thanx for reply yes i am working on reports in my db all the users have similar fields like state,city,country i want to retrieve only logged user report wen he entered in to his account so i want to give a select query dynamically at run time pls give suggestion with example.
Thaqnx
April 20, 2009 at 5:19 am
Hi
Within Reporting Services there is a Global variable called [UserId].
You will need to create a report parameter and assign its default value to use the [UserId] global variable. You can then reference this report parameter in the WHERE clause of your dataset.
I'm assuming you have a table that has your user information stored by userid;
April 21, 2009 at 2:50 am
You can also use the below to get user name in sql queries.
SELECT SYSTEM_USER
May 4, 2009 at 6:04 pm
Hi,
If you are using a web site, then it would be a better idea to use the HTTP_REFERER to read the user id and display it on the page. You can also use this to log user activity in the database.
If you want to find out the user in the database, use user_id() or user_name() from the sql server database.
🙂
May 6, 2009 at 5:22 am
You could use your ASP/PHP form(POST/GET) variable to show the user. Take care with the SQL injections.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply