I'm still getting this error
error CS0311: The type 'AnonymousType#1' 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 implicit reference conversion from 'AnonymousType#1' to 'System.Data.DataRow'.
in my code:
DataTable tableSimCnfCopy = tableSimCnf.Clone ();
var varLst2 =
from car in tableSimCnf.AsEnumerable()
select new
{
ModelID = car.ModelID,
VehiclePrice = car.VehiclePrice,
APR24PercDown = car.APR24PercDown,
APR36PercDown = car.APR36PercDown,
APR48PercDown = car.APR48PercDown,
APR60PercDown = car.APR60PercDown,
APR72PercDown = car.APR72PercDown
};
varLst2.CopyToDataTable(tableSimCnfCopy, LoadOption.PreserveChanges);
But if to rename
varLst2.CopyToDataTable(tableSimCnfCopy, LoadOption.PreserveChanges);
to
varLst2.
CopyToDataTable2(tableSimCnfCopy, LoadOption.PreserveChanges);
and accordingly
public static DataTable
CopyToDataTable2<T>(this IEnumerable<T> source,
DataTable table, LoadOption? options)
it compiles ok. Why?
[tfl - 24 08 09] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at http://www.microsoft.com/communities/newsgroups/en-us/. You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
Visual Studio : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C&
SQL Server : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.sqlserver%2C&
.NET Framework : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
PowerShell : http://groups.google.com/group/microsoft.public.windows.powershell/topics?pli=1
All Public : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C&