[英]How to insert data from multiple tables to multiple tables by using SSIS?
[英]How to access data from multiple tables
如何編寫linq查詢以訪問多個表中的數據。如何為以下sql查詢編寫Linq查詢:-
"select * from user,employee where user.Name='smith' and employee.company='xyz'"
這樣的事情會做到的。
var q = from u in db.user
from e in db.employee
where u.Name == "smith" && e.company == "xyz"
select new
{
User = u,
Employee = e
};
這取決於您使用的linq提供程序。 例如,假設您正確定義了外鍵,則實體框架將創建它們所謂的“導航屬性”。 因此,您可以通過這種方式輕松地編寫類似於上面的linq查詢:
var query = data.Where(employee => employee.Name == "Smith" && employee.Company.Name == "xyz");
var result = from u in context.User
from e in context.Employee
where (u.Name == "smith" && e.company == "xyz")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.