How to check column names of a datatable without considering its cases

I have a datatable dt,
I need to check if a column name is present in the datatable.columns ,
the check shouldnt consider the cases

Is there any way to solve this issue without using looping

Hi,

How about the following expression?

dt.Columns.Cast(Of DataColumn).Any(Function(dc) dc.ColumnName.ToUpper=yourString.ToUpper)

This returns true if there is same column name with your string case-insensitively.

Regards,

Hi @nirmal.john,
This might help you to check:
Dt.Columns.Contains(“Column Name”) in an If condition.
Note-Dt is extracted datatable name.

Thanks & Regards,
Shubham Dutta

1 Like