when you learn LINQ, you should use LINQ to SQL tools---linqpad, just starting with, not quite familiar with, especially when it comes to multi-table queries, not writing LINQ statements?
This is not a problem, let's first introduce another tool SQL to Linq,sql has been learning for a long time, do the system often used, for SQL statements should be familiar with it.
Open SQL Server 2008, create a new query, I want to match the information in three tables to one by one, and as long as I want the information of the field, the SQL statement:
SELECT [T2]. [Virtualexamroomid], [T2]. [Virtualexamroomname], [t0]. [Examid], [t0]. [Examname], [T1]. [Examineeexamid], [T1]. [Examineename] From [examexamentity] as [t0], [examexamineeexamentity] as [T1], [examexamroomplanentity] as [T2]where ([t0].[ Examid] = [T1]. [Examexamentityexamid]) and ([t1].[ Examexamroomplanentityvirtualexamroomid] = [T2]. [Virtualexamroomid])
Execute, display the relevant field information in the three tables I want:
Then, open SQL to Linq,tools--linqer Connections, and create a new connection:
Select Add:
Set up the database to connect to,
Select LINQ to Entities:
To create a new file, place it under one of the following folders:
confirm, copy the SQL statement to the left SQL box, select the connection you just created in the upper connection, execute it, and then the right side will display the corresponding LINQ statement:
copy the LINQ statement to LINQPad and run:
perfect!!! , use tools, improve development efficiency!
SQL to LinQ you know what?