请帮我搞清楚这个。所以我试图在表单中的标签中显示具有相同值的记录数。
SELECT Status_ , COUNT(Status_) FROM ISSUANCE WHERE Status_ = 'Draft' GROUP BY Status_
我该如何显示?谢谢。
Dim disconn As New SqlConnection("Server = EURIZZE-PC;Database = INTERTRANS;Integrated Security = SSPI;")
Dim DataSet2 As New DataSet
Dim sqlcon As String = "SELECT ISSUANCE.Status_ , COUNT(Status_) FROM ISSUANCE WHERE Status_ = 'Draft' GROUP BY Status_"
Dim sqlda As New SqlDataAdapter(sql, thisConnection)
da.Fill(DataSet1, "ISSUANCE")
NameLabel1.DataBindings.Add("text", DataSet1, "") 'So I am having trouble on how to display it. Because the rowcount is not a permanent column.
答案 0 :(得分:1)
可能会使用case
表达式更改您的查询,例如
SELECT Status_ ,
SUM(CASE WHEN Status_ = 'Draft' THEN 1 ELSE 0 END) AS NewSum
FROM ISSUANCE
GROUP BY Status_;
答案 1 :(得分:1)
你在使用win-forms吗?你这里没有提供太多信息......
Label newlabel = new Label();
newlabel.Text = ""; // <- put your query-result in here
答案 2 :(得分:0)
尝试以下方法
$watch