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()
'======================================================================================================

Iftikar HussainPosted Jul 30, 2013, 12:30 PM
Try like this
Regards,
Iftikar
abhishek goletarPosted Jul 30, 2013, 10:53 AM
VulpesPosted May 16, 2013, 8:29 AM
The type following 'Of' should of course be the type of the "agcode" and "aggrpcd" columns in the datatables.
System.Data.DataSetExtensions.dll is part of the .NET framework but it's not included in your projects by default. You therefore have to add a reference to it manually.
Manoj PatelPosted May 16, 2013, 7:47 AM
VulpesPosted May 16, 2013, 7:01 AM
Also, I'd have thought that you'll need to insert the appropriate types after 'Of' and remove the semi-colon at the end of the 'query' declaration to get it to compile.