Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting same data table after LINQ query
Message
 
 
To
10/06/2014 17:30:16
General information
Forum:
ASP.NET
Category:
LINQ
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01601612
Message ID:
01601621
Views:
18
>>
>>   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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform