I wrote the query using LinQ and I used the CopyToDataTable method. At that line it is showing implicit conversion type error from my database type to System.Data.DataRow.
var query = from i in dbContext.Personaldetails
where i.ID == 1
select i;
return query.CopyToDataTable();
Any suggestions?
CopyToDataTablerequires collection ofDataRowobjects. See How to: Implement CopyToDataTable Where the Generic Type T Is Not a DataRow to solve this problem.UPDATE: If your entity has nullable field, you can modify
ObjectShredder.ExtendTablemethod. Find place where new columns are added to table, and remove second parameter, which provides type of data in column (DataColumn class does not support nullable data types):