C# – Get column values by name instead of by number with SqlDataReader

When you execute a SQL query and read the results with SqlDataReader, you have two options for getting column values by name (instead of by ordinal number): I’ll show examples below. Read column by name with the indexer You can use the indexer to read columns by name (or by ordinal number). This returns an … Read more

C# – Using SqlDataReader to process multiple result sets

In this article I’ll show how to use the SqlDataReader ADO.NET class in two scenarios involving multiple result sets: I have a StreamingService database that has Movies, Shows, and Episodes tables (linked to the shows). First I’ll show the model classes I’m mapping the data into. Then I’ll show the two scenarios where I’m using … Read more