Datatable does not contain definitions for AsEnumerable using LinqBridge1.1 in C # 2.0

I am trying to use linq in C # 2.0 (linqbridge) to search for a patient name in my database, but I get the following errors: System.Data.Datatable does not contain a definition for AsEnumerable () System.Data.Datatable does not contain a definition for CopyToDataTable ()

I added the linqBridge.dll link to my project. And I use:

using System.Linq;

List<string> names = name.Split(' ').ToList(); SqlConnection con = new SqlConnection(m_connection_string); SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM PATIENT", con); DataSet ds = new DataSet(); da.Fill(ds); var query = from pat in ds.Tables["PATIENT"].AsEnumerable().Where(c => names.All(val => c.PAT_SEARCH_NAME.Contains(val))) select pat; DataTable table = query.CopyToDataTable(); 

What am I doing wrong? I already read that this version of LinqBridge (1.1) does not contain these methods. Is there any way to solve this?

Thanks.

+4
source share
2 answers

Have you tried adding System.Data.DataSetExtensions to your dll project?

+20
source

To complete the previous answer, if you cannot add a link to System.Data.DataSetExtensions using Visual Studio, I managed to do this by manually editing the library project file directly. Just insert the correct line from existing links:

 <Reference Include="System.Data" /> <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Runtime.Remoting" /> 
0
source

All Articles