Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting same data table after LINQ query
Message
 
 
À
10/06/2014 17:30:16
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01601612
Message ID:
01601621
Vues:
19
>>
>>   var query = from c in dtInstructors.AsEnumerable() 
>>                                  where (from b in dtAllScheduled.AsEnumerable() where 1 == b.Field<Byte>("layer") 
>>                                          && b.Field<   )
>>
>>based on http://www.telerik.com/forums/exists-query-in-dynamic-linq
>
>Add "select c" at the end to select your datarow from dtInstructors. Use CopyToDataTable (http://msdn.microsoft.com/en-us/library/system.data.datatableextensions.copytodatatable%28v=vs.110%29.aspx) to put the results back into a datatable if there are any results.

For now I am struggling to write the query. I decided to try Any operator, but I can not figure out how to add second table.

Here is what I have now and confused as what I wrote makes no sense and I don't know how to fix:
  // Remove instructors who don't have anything planned
                      var query = from c in dtInstructors.AsEnumerable().Any 
                                   (from b in dtAllScheduled.AsEnumerable() where 1 == b.Field<Byte>("layer") 
                                          && true==b.Field<Boolean>("schassign") && c.Field<String>("instr_id")== b.Field<String>("resource_id")
                                          );
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform