如何显示数据表的某些行?

发布于 2025-02-11 08:55:22 字数 494 浏览 1 评论 0原文

在显示我的CollectionView(包含数据)时,我只想显示具有字段“ number” = xx的行,

我当前像这样显示我的数据:

public async Task<List<DB_PosteNF>> ListerPF()
{
  try
  {
     return await connection.Table<DB_PosteNF>().ToListAsync();
  }
  catch (Exception ex)
  {
      StatutMessage = $"Impossible d'afficher la liste des postes de frais. \nErreur : {ex.Message}";
  }
      return new List<DB_PosteNF>();
}

这是表的结构,我想要主键号=外键

表1: 主键=编号

表2: 主键= ID 外键=数字

When displaying my CollectionView (which contains the data), I would like to display only the rows that have the field "Number" = xx

Currently I display my data like this:

public async Task<List<DB_PosteNF>> ListerPF()
{
  try
  {
     return await connection.Table<DB_PosteNF>().ToListAsync();
  }
  catch (Exception ex)
  {
      StatutMessage = 
quot;Impossible d'afficher la liste des postes de frais. \nErreur : {ex.Message}";
  }
      return new List<DB_PosteNF>();
}

Here is the structure of my tables, I would like Primary Key number = Foreign Key

Table 1:
Primary Key = Number

Table 2:
Primary Key = Id
Foreign key = Number

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

愿与i 2025-02-18 08:55:22

使用Linq

connection.Table<DB_PosteNF>().Where(x => x.Number == SomeValue).ToListAsync();

替换somevalue与您要过滤的值

Use LINQ

connection.Table<DB_PosteNF>().Where(x => x.Number == SomeValue).ToListAsync();

Replace SomeValue with value you want to filter by

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文