On Fri, Jul 13, 2012 at 9:15 AM, jtaylor <[email protected]> wrote:
> I am building an in-memory DataSet from non-structured data. I need
> to JOIN and query data across tables. DataTable has a .Select method
> but DataSet does not. I tried to use LINQ, but it gives me a
> "Expression of the type 'System.Data.DataTable' is not queryable.
> Make sure you are not missing an assembly reference and/or namespace
> import for the LINQ provider.", and I cannot find anything missing.
>
> What is the best way to SELECT across tables within a DataSet?
--------------
Don't use DataSet or DataTable for your container. Put it into an data object:
var myPO = (from p in db.PurchaseOrders
// Query of data from backend
where p.dtmAdded >= pastdate
orderby p.dtmAdded descending
select new PO
// Data object loading is below
{
dtmAdded = (DateTime)p.dtmAdded,
errorChecked = (Boolean)p.ErrorChecked,
poCurrency = p.POCurrency,
poDate = p.PODate,
poID = (Int32)p.POID,
poNumber = p.PONumber,
poStatus = p.POStatus,
poTime = p.POTime,
printed = (Boolean)p.Printed,
referenceID = p.ReferenceID,
requestMade = (Boolean)p.RequestMade,
tradingPartnerID = p.TradingPartnerID
}).ToList();
return myPO;
--
Stephen Russell
Sr. Analyst
Ring Container Technology
Oakland TN
901.246-0159 cell
--
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net