Hi guys, i have a login page where i created a session trainer after login. the session is the mail address of the trainer.

now from another apsx page, i would like to retrieve the staffid of the user logged in using the session as criteria.
I tried to write the below code but its not working. Any ideas please?

  Dim cmd As New SqlCommand
        Dim query1 As String

        query1 = "SELECT staffid FROM tblstaff WHERE email='" & Session("trainer") & "'"

        connect.ConnectionString = Constr
        connect.Open()

        cmd = New SqlCommand(query1, connect)

        Dim rdr As SqlDataReader = cmd.ExecuteReader
        Dim bFound As Boolean = False
        If rdr.Read() Then
            Dim staffid As String = rdr("staffid")
            lblStaffID.Text = staffid

        End If
        rdr.Close()

        connect.Close()