Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select to a temporary cursor
Message
De
05/12/2008 07:38:53
John Baird
Coatesville, Pennsylvanie, États-Unis
 
 
À
05/12/2008 00:56:26
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01365559
Message ID:
01365622
Vues:
11
>Hi John,
>
>I haven't played around with LINQ much at all, so I have a question for you. In the following lines of code:
>
>
>DataTable orders = ds.Tables["SalesOrderHeader"];
>
>var ordersQuery = orders.ToQueryable();
>
>
>where does "ToQueryable()" come from? I checked the documentation and didn't see that method associated with a DataTable, as you're using it. Perhaps that's part of Kevin's extension method, but I don't see it in the code you posted either. Did I miss something or did you leave out some of the code? Do you have a link to the article or blog where Kevin posted this?
>
>Thanks!
>~~Bonnie
>
>

LOL, thanks for pointing that out. That comes from an example set from DLinQ. I guess I shouldn't post after a night of imbibing adult beverages...Here is the correct information from an article by Kevin Goff: http://www.devx.com/codemag/Article/35390/1954?pf=true:

This code references the extension method AsEnumerable, from the System.Data.EntityClient namespace
DataTable orders = ds.Tables["SalesOrderHeader"];

varr query = from o in orders.AsEnumerable()
                 where o.Field<bool>("OnlineOrderFlag") == true
                 select new { SalesOrderID = o.Field<int>("SalesOrderID"), OrderDate = o.Field<DateTime>("OrderDate") };

dtResults = query.ToADOTable( rec => new object[] {query});
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform