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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session variable

Status
Not open for further replies.

primagic

IS-IT--Management
Jul 24, 2008
476
GB
I have a login page where users authenticate against an SQL database. They login using their traderID and their password. A session variable is stored using the traderID entered. I use this to display orders and sales relating to that traderID. This works fine.

What I want to do is rather then just display "Welcome back TraderID 12345", I want to display "Welcome back Firstname Lastname" where the Firstname and surname are looked up in the same SQL table as the TraderID field.

How would I populate the labels with this information. Or which is the best way of achieving this.

Thanks
 
you could just handle this in a class something like:

Code:
Public Class User
    Private _UserID As Integer
    Private _FirstName As String
    Private _LastName As String

    Public Sub New(ByVal UserId As Integer)
        GetUser(UserId)
    End Sub

    Private Sub GetUser(ByVal UserID As Integer)
        'Run query here where UserID = UserID and set
        'FirstName = "query.FirstName"
        'LastName = "query.LastName"
    End Sub

    Public Property LastName() As String
        Get
            Return _LastName
        End Get
        Set(ByVal value As String)
            _LastName = value
        End Set
    End Property

    Public Property FirstName() As String
        Get
            Return _FirstName
        End Get
        Set(ByVal value As String)
            _FirstName = value
        End Set
    End Property

    Public Property UserID() As Integer
        Get
            Return _UserID
        End Get
        Set(ByVal value As Integer)
            _UserID = value
        End Set
    End Property

End Class

Depending on your situation you "could" seralize the class and store it in your session but I am not sure you would want to do that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top