Tuesday, September 27, 2011

Remove Blank Rows From Datatable


  for (int ikj = 0; ikj < dt.Rows.Count; ikj++)
            {
                _isEmpty = true;
                for (int jkj = 0; jkj < dt.Columns.Count; jkj++)
                {
                    if (string.IsNullOrEmpty(dt.Rows[ikj][jkj].ToString()) == false)
                    {
                        _isEmpty = false;
                        break;
                    }
                }
                if (_isEmpty == true)
                {
                    dt.Rows.RemoveAt(ikj);
                    ikj--;
                }
            }

No comments:

Post a Comment