If you want to delete the empty rows considering the whole DATATABLE then
DataTableName=DataTableName.Rows.Cast(Of DataRow)().Where(Function(row) Not row.ItemArray.All(Function(field) field Is DBNull.Value Or field.Equals(""))).CopyToDataTable()
Or
If you want to delete empty rows based on one column
DatatableName = DataTableName.Select("Convert(column3, System.String)< >''").CopyToDataTable()
or Datatablename = DataTableName.Select("column3< >''").CopyToDataTable()
(From r in DtMaster.Rows.Cast(Of DataRow)().Where(Function(r) Not r.ItemArray.All(Function(field) field Is DBNull.Value Or field.Equals("")))).CopyToDataTable()
I am sorry… I think I did not put the exact requirement in my original question. I have a datatable in which few columns have blank values. I just want to know if any of the column values contains string or not. Or is there a way to count the number of blank values in the datatable.
Consider the above scenario where in the second row few columns are empty, when I read that row I want to check if it contains a string or not.
I just want to check if the value in the cell is string. String value could be anything, I am not looking for any certain string, need to check if value in the cell is a string or not
when counting the blanks and rows Count * Col Count = No Of All Columns we can calculate the filled Columns
As mentioned about the different interpetations, we would recommend that the definition of your focused target should be very clear and detailed
e.g. 123 number could be counted as string
e.g ABC Letters could be counted as string
e.g. ABC123 could not be counted as string, with a definition of only letters
A column value like d(“ColName”).toString.Length > 0 would not serve as for complex datatype the output would be the datatype name and would confuse the counting.
So as mentioned above. Please give us clear, reliable and sharp definition and requirement description on what you are looking for. We had provided several suggestions. The topic title not matching your need etc. we can faster help when you come across with the clear requirement (e.g. sample data along with expected output description) Thanks for support.