0

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

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by ricksvoid
1
Dim query As String = "Select * From someTable Where UserName = '" & theUser.ToString() & "'"
0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.