Does IDataReader.GetName (i) work with empty data readers?

In the case of an empty data reader, I want field names with empty values ​​to be displayed. Those.

Product: - Price: -

So, are IDataReader.GetName (i) and IDataReader.FieldCount safe to use when they have no results?

+4
source share
1 answer

In fact, I just experienced this myself, running the reader against an empty set. Then without calling Read (); I successfully crash FieldCount and GetName (i) for all columns, while the data reader had 0 rows.

+4
source

All Articles