在桌子上寻找非空的细胞

0 c# sql

我有一个叫做DueInTable带字段的表RepairNumber.

如何编写一个仅返回此字段不为空的gridDataView中的记录的SQL语句?

这是我尝试OnLoad用于表格的事件:

label1.BackColor = Color.Transparent;
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
string data = "Select * from DueInTable WHERE RepairNumber = !NULL";
DataTable dt = new DataTable();
DataSet ds = new DataSet();
OleDbDataAdapter adapter = new OleDbDataAdapter(new OleDbCommand(data, connection));
adapter.Fill(ds);
DataView DV = new DataView();
DV.Table = ds.Tables[0];
Repair_dtGrdVw.DataSource = DV;
Run Code Online (Sandbox Code Playgroud)

Pat*_*man 5

WHERE RepairNumber = !NULL实际上在SQL 意味着repairNumber不是'undefined'.由于"未定义的东西"(或者你无法确定其值)永远不会是"未定义的东西",因此与之相比=总会失败.

这就是为什么有一个is (not) null运营商:

WHERE RepairNumber is not null
Run Code Online (Sandbox Code Playgroud)