I have a click button in my page and when I click it more than one time the value for session variable losing the stored value. anybody has an idea why this is happening. I am getting the value for session varialbe form another page.thanks
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim TmReview As String
TmReview = Session("TmId")
'Response.Write("Here is the value" & TmReview)
If Not IsPostBack Then
Label1.Text = "Select Review Participants for TM " & TmReview
MemoReviewers()
CheckReviewers(TmReview)
End If
End Sub
Sub CheckandUpdateDb()
Dim strReviewrsId As String = ""
For Each li As ListItem In cblReview.Items
If li.Selected Then
strReviewrsId = strReviewrsId & li.Value & ","
End If
Next
strReviewrsId = Left(strReviewrsId, Len(strReviewrsId) - 1)
Session("TmReviewrsId") = strReviewrsId
Dim TmReview As String
TmReview = Session("TmId")
Dim strTechMemoConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\DataBase\techmemo.mdb") & ";"
Dim MyTechMemoConn As New OleDbConnection(strTechMemoConn)
Dim strStringBuilder As StringBuilder
strStringBuilder = New StringBuilder
With strStringBuilder
.Append("SELECT * from tbTM WHERE TM =" & "'" & TmReview & "'")
End With
Dim cmdReview1 As OleDbCommand = New OleDbCommand
cmdReview1.Connection = MyTechMemoConn
cmdReview1.CommandType = CommandType.Text
cmdReview1.CommandText = strStringBuilder.ToString
Dim adReview1 As New OleDbDataAdapter(cmdReview1)
Dim builder As OleDbCommandBuilder = New OleDbCommandBuilder(adReview1)
Dim dsReview1 As New DataSet
adReview1.Fill(dsReview1, "ReviewList")
Dim count As Integer = dsReview1.Tables("ReviewList").Rows.Count
Response.Write(TmReview)
Response.Write(count)
End Sub