;

How to Check if the Specific Column Name is exists in the DataTable in C#


Tutorialsrack 09/12/2020 C#

In this article, we will learn how to check if the specified column name exists in the DataTable in C# or Not. 

Here is the source code of the program to check whether the specific column exists in the DataTable or not.

Code - Specific ColumnName exists in the Datatable
        private bool isColumnExists(string columnName, DataTable table)
        {
            bool columnExists = false;
            DataColumnCollection columns = table.Columns;
            if (columns.Contains(columnName))
            {
                columnExists = true;
            }
            return columnExists;
        }

I hope this article will help you to understand how to check if the specified column name exists in the DataTable in C# or Not. 

Share your valuable feedback, please post your comment at the bottom of this article. Thank you!


Related Posts



Comments

Recent Posts
Tags