I am new in Linq. The error(conversion from string "SYMBOL" to type integer is not valid) comes in the line : ' r("SYMBOL") = q!SYMBOL.ToString'. Please help
Dim tblBhavNSEFO As DataTable = gbl_dsBhavNSEFO.Tables(0)
Dim tblSource As New DataTable
tblSource.Columns.Add("SYMBOL", GetType(String))
Dim tblsymbols As DataTable = (From s In tblBhavNSEFO _
Where s!INSTRUMENT = strCondition _
Order By s!SYMBOL Ascending _
Select s).CopyToDataTable
Dim filter = From f In tblsymbols _
Select f!SYMBOL Distinct
If filter.Count > 0 Then
For Each q In filter
Dim r = tblSource.NewRow()
r("SYMBOL") = q!SYMBOL.ToString
tblSource.Rows.Add(r)
Next
!SYMBOLtoo many (you already reduce to!SYMBOLinfilter).filteralready reduces your list of datarows to a list of whatever-datatype-symbol-is. In other words:qalready contains your symbol, not a datarow, so there's no need to!SYMBOLit.