Check for column name in a SqlDataReader object
问题 How do I check to see if a column exists in a SqlDataReader object? In my data access layer, I have create a method that builds the same object for multiple stored procedures calls. One of the stored procedures has an additional column that is not used by the other stored procedures. I want to modified the method to accommodate for every scenario. My application is written in C#. 回答1: public static class DataRecordExtensions { public static bool HasColumn(this IDataRecord dr, string