继承我的代码:
select offer_id, min(c) as cnt
from
(
select
offer_id,
sum(case when <condition> then 1 else 0 end)
over (partition by offer_id order by created_at) as s,
count(*) over (partition by offer_id order by created_at) as c
from mytable
) data
where s = 1
group by offer_id
order by offer_id;
这是我的listview(staffelist),其中fullrowselect = true
private void employeelist_SelectedIndexChanged(object sender, EventArgs e)
{
if (employeelist.SelectedItems.Count > 0)
{
console.Text = employeelist.SelectedItems.Count.ToString(); // returns 1 it should return 3
}
}
当我点击第一行时,employeelist.SelectedItems.Count应返回3,但它会一直返回1
答案 0 :(得分:1)
您要执行的操作,不是使用SelectedItems
,而是使用SubItems
的{{1}}属性作为所选的给定ListViewItem
。
然后你可以这样做:
ListView.Items[selectedIndex].SubItems.Count;
当然,您的selectedIndex
就是用户点击的内容。
答案 1 :(得分:0)
我不确定你到底想要的是什么。您的ListView的MultiSelect属性可能设置为false。如果要选择多于1个项目,请将MultiSelect设置为true。
如果您只是想计算ListView中的总项数:
employeelist.Items.Count;