How can I validate if the column exist in a DataRow object?
12,595
You can also use this one statement
row.Table.Columns.Contains("EmploymentID")
Related videos on Youtube
Author by
Jerameel Resco
He is a .NET Developer focusing on C#. Has a professional experience on both ASP .NET and ASP .NET MVC. He found himself fond in exploring and coding using React JS or any JS library on Node. I'm a never ending learning programmer.
Updated on June 30, 2022Comments
-
Jerameel Resco almost 2 years
private int EmploymentID { get; set; } private void MapFields(DataRow row) { if(row.HasError) EmploymentID = Convert.ToInt32(row["EmploymentID"].ToString()); }
The code shows that it validates if the DataRow object has error on its row but I want to validate if it ever exist. Is there an approach for the code rather using HasError method of DataRow?
Thank you for any kind answers.