i am going to bind a datatable by linq query to database Below is my query..
DataTable table = new DataTable(); IEnumerable<double> query = (from st in obj.Book_details select new {st.Category,st.Book_Id,st.Edition,st.Name,st.Price,st.Quantity,st.Quick_overview }).Take(20); query.CopyToDataTable(table, LoadOption.PreserveChanges);<pre lang="text">
Error 149 The type 'double' cannot be used as type parameter 'T' in the generic type or method 'System.Data.DataTableExtensions.CopyToDataTable<T>(System.Collections.Generic.IEnumerable<T>, System.Data.DataTable, System.Data.LoadOption)'. There is no boxing conversion from 'double' to 'System.Data.DataRow'. Cannot implicitly convert type 'System.Linq.IQueryable<AnonymousType#1>' to 'System.Collections.Generic.IEnumerable<double>'. An explicit conversion exists (are you missing a cast?)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)