Manoj Patel

Manoj Patel

  • NA
  • 26
  • 15k

Linq Error

May 16 2013 5:52 AM

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)