是否可以将整个加入表数据返回到DataGridView而不是一个一个一个指定项目?

发布于 2025-01-29 10:14:50 字数 537 浏览 2 评论 0原文

我正在尝试将所有数据从加入表中获取到数据审核,但是我学到的只是在选择语句中逐一指定属性,如下所示:

var query = (from inv in db.tblinventories
  join sup in db.tblsuppliers on inv.SupplierID equals sup.SupID into left
  from sup in left.DefaultIfEmpty()
  select new { inv.Invnum,inv.Model, sup.name }).ToList();
                this.dgvPOS.DataSource = query;```

这是获取所有数据的唯一方法吗?因为在Oracle SQL中,通过使用“*”来表示这样的所有属性非常简单:

SELECT * 
FROM tblinventories 
LEFT JOIN tblsuppliers
ON tblinventories.SupplierID = tblsuppliers.SupID;
 

I am trying to get all data from the join table to data review, but what I learn is just to specify the attributes one by one in the SELECT statement as following code:

var query = (from inv in db.tblinventories
  join sup in db.tblsuppliers on inv.SupplierID equals sup.SupID into left
  from sup in left.DefaultIfEmpty()
  select new { inv.Invnum,inv.Model, sup.name }).ToList();
                this.dgvPOS.DataSource = query;```

Is this the only way to fetch all data? Because in ORACLE SQL the way is quite simple by using "*" to represent all attributes like this:

SELECT * 
FROM tblinventories 
LEFT JOIN tblsuppliers
ON tblinventories.SupplierID = tblsuppliers.SupID;
 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文