Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting same data table after LINQ query
Message
De
10/06/2014 17:16:19
 
 
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:
01601618
Vues:
31
>Hi everybody,
>
>I have 2 data tables dtInstructors and dtAllScheduled. I need to limit dtInstructors to only those that have corresponding rows in AllScheduled with Layer =1 and Flag = true.
>
>In Visual FoxPro this is done with the following query:
>
>
>IF empty(m.lcRequest)
>          SELECT * FROM b_instr1 b WHERE exists ;
>          (SELECT 1 FROM csrAllSched s WHERE s.resource1 = b.instr_id and s.layer = 1 and s.schdassign = .t.) ;
>          ORDER BY instr_id INTO CURSOR b_instr readwrite
>      ELSE
>         SELECT * FROM b_instr1 b WHERE exists ;
>          (SELECT 1 FROM csrAllSched s WHERE s.resource1 = b.instr_id and s.layer = 1 and s.schdassign = .t.) ;
>         UNION ; 
>         SELECT * FROM b_instr1 WHERE ALLTRIM(instr_id) == m.lcRequest ;  
>         ORDER BY instr_id INTO CURSOR b_instr readwrite
>      endif
>
>In my case I need to do a similar kind of query with LINQ and get back dtInstructors again. Do you know how this can be done?
>
>Thanks a lot in advance.

Exists becomes Any (http://msdn.microsoft.com/en-us/library/vstudio/bb534972%28v=vs.100%29.aspx).
Union is still Union (http://msdn.microsoft.com/en-us/library/vstudio/bb358407%28v=vs.100%29.aspx).
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform