簡體   English   中英

如何檢查SQL Server數據庫C#winform中是否存在記錄?

[英]How to check if a record exists in the SQL Server database C# winform?

我的Windows窗體應用程序是關於書店。 我想在ComboBox中顯示PO編號,這些編號沒有創建好收到的注釋。

這是這兩個表的結構。

PO表 -

在此輸入圖像描述

GRN表

在此輸入圖像描述

如何更改以下代碼?

 public void fillPOcombo()
 {
        DynamicConnection con = new DynamicConnection();
        con.mysqlconnection();
        con.sqlquery("select PO_No from TBL_PO");
        con.dataread();

        while (con.datareader.Read())
        {
            cmbpono.Items.Add((int)con.datareader["PO_NO"]);
        }
}

我想說如下:

更改

con.sqlquery("select PO_No from TBL_PO");

con.sqlquery("select PO_No from TBL_PO where PO_No not in (select PO_No from GRN)");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM