代码之家  ›  专栏  ›  技术社区  ›  climivin

数据表。“select”方法只返回一行

  •  0
  • climivin  · 技术社区  · 6 年前

    dataGridView1具有 select 类型字段 bool .
    以编程方式选择两条线。

    代码显示在中 DataRow [] selectedRows; 只有最后一行。(线路 dataGridView1 [" select ", 1] is displayed. Value = true; )

    绳子 dataGridView1 [" select ", 0] .Value = true; 数据行[]selectedRows; 不见了。

    怎么做的 字段“select”=true的所有行。?

    dataGridView1.DataSource = dtTest;
    
    dataGridView1["select", 0].Value = true;
    dataGridView1["select", 1].Value = true;
    
    DataRow[] selectedRows;
    selectedRows = dtTest.Select("select = true"); 
    

    更新。
    数据库-MSAccess
    字段“id”是主键。

    enter image description here

    0 回复  |  直到 6 年前