Remove empty row from datatable in VB.NET
DataTable = DataTable.Rows.Cast(Of DataRow)().Where(Function(row) Not row.ItemArray.All(Function(field) TypeOf field Is System.DBNull OrElse String.Compare(TryCast(field, String).Trim(), String.Empty) = 0)).CopyToDataTable()
in C#
DataTable = DataTable.Rows.Cast(Of DataRow)().Where(Function(row) Not row.ItemArray.All(Function(field) TypeOf field Is System.DBNull OrElse String.Compare(TryCast(field, String).Trim(), String.Empty) = 0)).CopyToDataTable()
in C#
dataTable = dataTable.Rows.Cast<DataRow>().Where(row => !row.ItemArray.All(field =>
field is System.DBNull || string.Compare((field as string).Trim(),
string.Empty) == 0)).CopyToDataTable();
Referred from
No comments:
Post a Comment