5
Answers

Linq Error

Manoj Patel

Manoj Patel

11y
1.7k
1

Hi,

I'm using Linq in Vb.net 2012
but I'm getting an error as " 'query' is not declared. It may be inaccessible due to its protection level"


how to solve this issue

Imports System.Windows
Imports System.Data
Imports System.Data.SqlClient
Imports System.Linq
Imports System.Collections.Generic

'======================================================================================================
Dim parent As DataTable = dset.Tables("magenmst")
Dim child As DataTable = dset.Tables("magengrp")

dim query   = _
            From P In parent.AsEnumerable, c In child.AsEnumerable _
            Where P.Field(Of)("agcode") = c.Field(Of )("aggrpcd") _
            Select P,c;

        Dim view As DataView = query.AsDataView()
'======================================================================================================

Answers (5)