What I want to do is get a users current login username, and pass it to an SQL query which will search a table and return all entries belonging to that person. Ive managed to pass the username onto a label when that person logs in.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim theUser = User.Identity.Name
        greeting.Text = "hello " & theUser.ToString()
    End Sub

I would like to take this a step further by allowing for a pageload event that automaticly querries a table and binds that information unto a datagrid. BTW... I am familiar with the sytax and logic involved with binding a set of records unto a datagrid control. What i am lacking is the knowlege to allow only information that pertains to the logged in user.

Please help,
Rick Pace

Dim query As String = "Select * From someTable Where UserName = '" & theUser.ToString() & "'"

Thanks, that totally worked. It seems i was missing the apostrophes.
ahhh sytax.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.