DataReader - hardcode ordinals?

前端 未结 6 2018
执念已碎
执念已碎 2021-01-11 10:29

When returning data from a DataReader I would typically use the ordinal reference on the DataReader to grab the relevant column:

if         


        
6条回答
  •  心在旅途
    2021-01-11 10:52

    The problem with ordinal is if the order of the columns change and you are forced to modify the consumer code for the DataReader, unlike using column names.

    I dont think there is a performance gain when using ordinal or column names, it is more on best practice and coding standards and code maintainability really

提交回复
热议问题