//20120803 Geovin Du //塗聚文 締友計算機信息技術有限公司 DataTable dt = new DataTable(); dt=agreementMonthlySalaryListBLL.SelectImportExceltoDataGridView(fileUrl, sheet).Copy(); if ((dt != null) && (dt.Rows != null) && (dt.Rows.Count > 0)) { List<System.Data.DataRow> removeRowIndex = new List<System.Data.DataRow>(); int RowCounter = 0; foreach (System.Data.DataRow dRow in dt.Rows) { for (int index = 0; index < dt.Columns.Count; index++) { if (dRow[index] == DBNull.Value) { removeRowIndex.Add(dRow); break; } else if (string.IsNullOrEmpty(dRow[index].ToString().Trim())) { removeRowIndex.Add(dRow); break; } } RowCounter++; } // Remove all blank of in-valid rows foreach (System.Data.DataRow rowIndex in removeRowIndex) { dt.Rows.Remove(rowIndex); } } dataGridView1.DataSource = null; set.SetDataGridViewBindingSourceNavigatorBinds(dataGridView1,dt , bindingSource1, bindingNavigator1);
时间: 2024-10-14 20:56:52