Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select from one strongly typed dataset to another
Message
From
09/07/2011 13:28:29
John Baird
Coatesville, Pennsylvania, United States
 
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01517609
Message ID:
01517815
Views:
43
>>Thanks for the tip Bonnie.
>>
>>I tried the code befow but get a message that " vfppriceds.icpric cannot be assigned to.. etc"
>>
>>So I copped out and looped thru the rows of source table of ds1 and imported the selected rows into the target table of ds2.
>>Not very pretty, tho.
>>There must be a better way.
>
>> vfppriceds.icpric = (MeycoPro60DataDataSet.icpricDataTable)ordVFPPro60.vfpds.icpric.Select("item = " + item).CopyToDataTable();
>
>You could try something in Linq. e.g:
DataSet1.TableA.Where(x=>x.Name=="Fred").ToList().ForEach(x => DataSet2.TableA.ImportRow(x));
Probably possible to improve by using a select with Action(T) instead of needing to create a list but haven't got C# in front of me and don't trust myself to write that unchecked :-{

Can't you use .AsEnumerable() too to avoid the use of .ToList()?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform