Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
lblSTuName.Text = "Welcome! " + Session("StuID")
If con.State = ConnectionState.Closed Then
con.Open()
End If
cmd = New OleDbCommand
cmd.Connection = con
cmd.CommandText = "select [Image] from tblStudent where Uname='" + Session("StuID") + "'"
Dim dr As OleDbDataReader
dr = cmd.ExecuteReader()
If dr.Read() Then
stuImage.ImageUrl = dr("Image")
Else
stuImage.ImageUrl = Nothing
End If
con.Close()
End Sub
i have this code in student.master page
and then i want the session("StuID") to use in chlid page also....i have written the following code in the child page student.aspx-
If Not IsPostBack Then
Dim stname As Label = TryCast(Master.FindControl("lblSTuName"), Label)
stuN = stname.Text
If con.State = ConnectionState.Closed Then
con.Open()
End If
cmd = New OleDbCommand
cmd.Connection = con
cmd.CommandText = "select [RollNo],[CourceName] from tblStudent where StuName='" + stuN + "'"
dr = cmd.ExecuteReader()
If dr.Read() Then
MsgBox("read complete")
Else
MsgBox("not success!")
End If
End If
but i am not able to use session here in the child page using this code.Can i get any help??