Q:

Datatable search by LINQ to avoid duplication

I have a column in dataTable with blank rows
Column1
A
B
C

D

E

I need to set if exist and to avoid adding, but blank rows should not be counted. Only rows with data should be in the (if exists). Thanks
 bool exists = dt.Select().ToList().Exists(row => row["column1"].ToString() == txtbox)

if(exists == true)
{}
else

// it includes blank so it goes to true, which I need is blank rows should not be included.

A:

var lignesNonContainEmptyString = dt.Select()
                   .Where(row => row["column1"] != null 
                                && row["column1"].ToString() == txtbox 
                                && !string.IsNullOrEmpty(row["column1"].ToString()))

bool exists = lignes.Count() != 0;

OR
bool exists = dt.Select()
                       .Any(row => row["column1"] != null 
                                    && row["column1"].ToString() == txtbox 
                                    && !string.IsNullOrEmpty(row["column1"].ToString()))

