C#sql查询清除null空值

查询 清除null空值 :delete from 历史盘点表 where 商品名 is null





            string MyConn = label1.Text;

            SqlConnection MyConnection = new SqlConnection(MyConn);
            string MyDelete1 = "delete from 历史盘点表 where 商品名 is null";
            string MyDelete2 = "delete from 历史盘点表 where 拼音 is null";
            string MyDelete3 = "delete from 历史盘点表 where 规格 is null";
            string MyDelete4 = "delete from 历史盘点表 where 上月末库存 is null";
            string MyDelete5 = "delete from 历史盘点表 where 本月采购数 is null";
            string MyDelete6 = "delete from 历史盘点表 where 本月销售数 is null";
            string MyDelete7 = "delete from 历史盘点表 where 库存 is null";
            string MyDelete8 = "delete from 历史盘点表 where 盘点时间 is null";

            SqlCommand MyCommand1 = new SqlCommand(MyDelete1, MyConnection);
            SqlCommand MyCommand2 = new SqlCommand(MyDelete2, MyConnection);
            SqlCommand MyCommand3 = new SqlCommand(MyDelete3, MyConnection);
            SqlCommand MyCommand4 = new SqlCommand(MyDelete4, MyConnection);
            SqlCommand MyCommand5 = new SqlCommand(MyDelete5, MyConnection);
            SqlCommand MyCommand6 = new SqlCommand(MyDelete6, MyConnection);
            SqlCommand MyCommand7 = new SqlCommand(MyDelete7, MyConnection);
            SqlCommand MyCommand8 = new SqlCommand(MyDelete8, MyConnection);

            MyConnection.Open();
            MyCommand1.ExecuteNonQuery();
            MyCommand2.ExecuteNonQuery();
            MyCommand3.ExecuteNonQuery();
            MyCommand4.ExecuteNonQuery();
            MyCommand5.ExecuteNonQuery();
            MyCommand6.ExecuteNonQuery();
            MyCommand7.ExecuteNonQuery();
            MyCommand8.ExecuteNonQuery();
            MyConnection.Close();

            MessageBox.Show("清空空值ok");

winform代码
桂ICP备16004754号