I get the below error
Unable to cast object of type 'System.String' to type 'System.Data.DataTable'.
This is the code I'm using
Dim str As String = String.Empty
If (Session("Brief") IsNot Nothing) Then
Dim dt As DataTable = Session("Brief")
If (dt.Rows.Count > 0) Then
For Each dr As DataRow In dt.Rows
If (str.Length > 0) Then str += ","
str += dr("talentID").ToString()
Next
End If
End If
Return str
Thanks
I'm not a VB guy, but I would have thought you would need to cast the session variable to the correct type (DataTable):
Dim dt As DataTable = CType(Session("Brief"), DataTable);