Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
LINQ to datatable - how to create a variable?
Message
 
 
À
23/06/2013 15:30:33
John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01576896
Message ID:
01576985
Vues:
48
>
>if you hover over the var declaration in the linq statement, it will tell you type. Then simply move it to the top with that type.

Ok, this seems to compile
EnumerableRowCollection<DataRow> query; 
                  if (checkType && checkCategory)
                      query = from c in dtMax4SaleLimits.AsEnumerable() 
                                 where (2==c.Field<Byte>("type") && lsn_cat == c.Field<String>("lsn_cat"))
                                 || (3==c.Field<Byte>("type") && lessontype == c.Field<Int32>("lessontype"))
                              select c;
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform