例如,使用以下代码。
SELECT COUNT(1) as 'ClientActive',
(SELECT COUNT(1) FROM t1 AS t2 WHERE t2.fieldname = 'A') AS TotalA,
(SELECT COUNT(1) FROM t1 AS t2 WHERE t2.fieldname = 'B') AS TotalB,
(SELECT COUNT(1) FROM t1 AS t2 WHERE t2.fieldname = 'C') AS TotalC,
(SELECT COUNT(1) FROM t1 AS t2 WHERE t2.fieldname = 'D') AS TotalD
FROM t1 WHERE clientstatus='active'
我想要这样的回报:
lblString1.Text = TotalA;
lblString2.Text = TotalB;
etc..
有人可以生成 C# 代码来执行此操作吗?谢谢你。