保存前,把空值改为零,然后保存

for (int i = 0; i < this.dataGridView_gzd_save.Rows.Count; i++)

            {
for (int j = 0; j < this.dataGridView_gzd_save.Columns.Count; j++)
                {
if (this.dataGridView_gzd_save.Rows[i].Cells[j].Value == "" || this.dataGridView_gzd_save.Rows[i].Cells[j].Value == null)
{
this.dataGridView_gzd_save.Rows[i].Cells[j].Value = "0";
}
                }
            }

posted @ 2020-04-26 15:29  clay111  阅读(75)  评论(0)    收藏  举报