Ich arbeite in Asp.Net 4.0 C# - MVC-3. Ich habe ein Problem und weiß nicht, wie ich es lösen soll. Ich habe 4 Tabellen und möchte Daten aus diesen Tabellen mit LINQ abrufen.LINQ Abfrage zum Abrufen von Daten aus mehreren Tabellen
TABLES
1) Project_Master
Field Names :
project_id (pk)
project_name
company_id (FK with company_master)
company_category_id (FK with Company_Category_master)
project_status_id (FK with Project_Status_Master)
2) Company_Master
Field Names :
company_id
company_name
company_category_id (FK with Company_Category_Master)
3) Company_Category_Master
Field Names :
Company_Category_Id
Company_Category_Name
4) Project_Status_Master
Field Name :
Project_Status_Id
Project_Status_Name
Dies sind die Felder, die ich .. holen müssen (mit LINQ-Abfrage)
- Company_Name
- Gesamt abgeschlossen Projektstatus mit ID (1) = Vollständig (wobei Status 1 bedeutet, abgeschlossen)
- Gesamtprojekt
- Company_category_name
Also, wie kann ich Daten mit Linq-Abfrage holen ??
Vielen Dank im Voraus ...
Ihre Frage nichts mit MVC zu tun hat. Es ist alles LINQ. –
Überprüfen Sie diese Frage: http://stackoverflow.com/questions/5207382/get-data-from-two-tablesjoin-mit-linq-and-return-result-into-view –
Wissen Sie, was ein [JOIN] (http://en.wikipedia.org/wiki/Join_(SQL)) ist? Es gibt auch ein Join-Schlüsselwort für linq. – Stephan