.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Find User info by UserId

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :ASP.Net

I'm sorry, this feels like such a stupid question. But here goes..

Every user on my page have their own guestbook on their profile. To show their guestbook I've used a QueryString with UserId, and it shows the specific users recieved messages. I also have the UserId of the profile that sended the message, but I would of course like to view the senders username instead of the UserId. The guestbook database looks like this..


I'd like to get info from the Users table and my ProfileTable for the senders username and profile image, how do I do that inside the DataList I've already used to show the users messages? I can't seem to find a way to get the Senders info, it will only show the User Info of the users who's guestbook i'm viewing.

I'm sorry for sounding so confusing, I hope someone can help me out..

View Complete Post

More Related Resource Links

App Lockdown: Defend Your Apps and Critical User Info with Defensive Coding Techniques


Whether you're storing database connection strings, user credentials, or logon info, you'll need to practice good defensive programming techniques to avoid those surprise situations in which your data is exposed. In this article, author Kenny Kerry shows you how.

Kenny Kerr

MSDN Magazine November 2004

=User!UserID from windows authentication using table from another database



i'm using sql server 2005, sql server business intelligence development studio for my reports and deploy them in my wss3.0 site.

what i'm trying to do is i'm trying to restrict wich users can see specific data within a report.

now, the thing is. the report gets the data out of my DB1 database and my windows authenticated user are in the WSS_content database.

when i deploy my report in my wss3 site. it gets the user that is loged in. but of course it does not display any data because the tables are not in the same database.

does someone knows how to do this?

How to make "UserId" equal to the "logged-in user" in vb code behind


I need to insert a declaration in the codebehind function below that will make the variable "UserId" equal to the "logged-in user". In what way do I need to change the code below (elsewhere in the project, I successfully make reference to basically the same code and make the UserId equal to logged-in user by using this handler expression inside an image control: ImageUrl ='<%# Eval("UserId","Image.aspx?UserId={0}")%>'...But in the case below, the function is not fired by this expression, but rather by CustomValidator). Thanks very much.


Sub ValidateImage(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)

        If Request.QueryString("UserId") IsNot Nothing Then
            ' Get the connection string from Web.config.

            Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("MyDatabaseConnectionString").ToString())
                ' Create a command object.

FBA users (ldap provider) don't have any user profile info when logged in.... what am I doing wrong

Sharepoint 2010, Claims authentication, FBA using ldap membership provider and role provider against Active Directory.  User profiles all imported just fine -- used the LDAP FBA provider hitting Active Directory to do so too.  whenever an FBA user logs in, it doesn't seem like sharepoint is picking up any user attributes.  targeted audiences don't work and MY SETTINGS is blank other than account and name.  If the same user logs in but through Active Directory, everything works just fine... targeted audiences, etc. Am I doing something wrong or can I not use the LDAP provider to authenticate to AD and also use the user profiles from Sharepoint?  GRRRRR.  All this to get around the Windows Authentication popup so I can customize a better looking logon experience.  Help?

VS , Where Create User Wizard Save User and Pass and info

Hi , First Sorry For My Bad English :DAnd Second:I Have Question : Can I Edit Create User Wizard To Save Info To My Project  Sql ? And Where Normal Create User Wizard Save Info Of Register ? TanX !! :D !

user!userID limits data by supervisor but want director to see everything

Ive used user!userID  to limit the information by who is logging in and it works fine, but I have a few directors that I want to see everything- how would I accomplish this ?? Let me know if anyone needs additional information thansk kam

Get user info in infopath using data connection

hi,  i want to use the absence request template form and connect the employee section and manager section to an existing database. what i want to create now in this template is this (i'm going to explain my scenario): - when the user open the infopath absence request form and insert his name, id number etc (employee section), the approver's name and mail addres (manager section) filled automatically. the approver name must be corresponding to the user name. in the existing database there is a table with the approvers name filled for each user, but from there i dont know how to apllicate this table to use for the auto fill. and after the form is ready can i publish it to my wss 3 site collection? is there a tutorial that explain a scenario like this? thnx

=User!UserID = Domain\User...

Question is, how can I only show the User and not the Domain\   ?


SPView query to find if the current user belongs to a Group


HI All,

I´m trying to write a query for a list view that should return all items if the current user belong to a group. If the user doesn´t belongs to this group, no items should be returned.

So far, I could find many equal examples about using the CAML Membership element in a comparison with an AssignetTo field. But not making a comparison between the current user and a specific Sharepoint Group.

Any suggestions, please?


Why separate account data and user info?



If I'm correct the membership functionality separates account and user (profile) data in two tables. Why not one table? What's the design priciple behind this?


Find User Password by Username Before Login


hi guys,

I have only username. and want to check and grab the password from the database. It is BEFORE LOGGING IN. so I don't think the build-in asp.net functions could be used, right?

thanks a lot!!

how to find User Mapping option of database properties.



Good evenning all.

Can any body tell me how to find User Mapping option of any database

in sql server 2008.

so that i can change the DB_OWNER name to AdMINISTRATOR.

Thanks to all.

Find all stored procedures/functions granted to a specific user


SQL 2005.

How can I find all routines (sp, fn) exec granted to a specific user in a given database ?

Thanks !!

Error while merging: "Could not retrieve column info from table tablename" and Could not find stored


Hi i am getting following error message while merging. Can any one please help?

We are using sql server 2005
I have this problem in publisher.Gone throught his article http://social.msdn.microsoft.com/Forums/en/sqlreplication/thread/b0bbc330-91df-45d5-8dbf-e2df461a8005 but no luck.

The merge process could not retrieve column information for table 'dbo.tablename'. Verify that you have sufficient privileges on the database and retry the operation. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147201016)
Get help: http://help/MSSQL_REPL-2147201016

Could not find stored procedure 'dbo.MSmerge_sel_sp_6481B06512B54C91FCC171C542E7'. (Source: MSSQLServer, Error number: 2812)
Get help: http://help/2812


Update User Profile info from another SharePoint site


Hi All,

I have MOSS 2007 up and running, and the Staff Profile is maintained by the users.

Now there is another NEW sharepoint 2010 apps planning. In order to avoid the duplication of staff profile in SharePoint 2010, the requirement is to update the SharePoint 2010 Staff Profile from the existing MOSS 2007.

Is it possible? Any help.


Get user details from Userid for not login member


I am using .net membership and have user profiles like firstname,lastname,address against each user.

My question is how to get user properties from their userid (Keeping in mind the user wont be login)?

Cannot find either Column "dbo" or the user-defined function or aggregate "dbo.GetCandiateID", or th



Good morning to everybody. I am not understanding why I am getting the following error (also mentioned in the subject line).

I have written the following function in SQL Server 2005:

    declare @candidate_id int
    SELECT @candidate_id = max(c.candidate_id) from dbo.candidates c
    if(@candidate_id is null)
        set @candidate_id = 1001
        set @candidate_id = @candidate_id + 1
    return @candidate_id

The function compiled properly. I have used the above function like below in the query:

select dbo.GetCandidateID()

I am getting the following error:

Cannot find either column "dbo" or the user-defined function or aggregate "dbo.GetCandidateID", or the name is ambiguous

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend