Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 106849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:39:41+00:00 2026-05-11T01:39:41+00:00

When retrieving values from a DataRow is it better to use the column name

  • 0

When retrieving values from a DataRow is it better to use the column name or column index?

The column name is more readable and easier to maintain:

int price = (int)dr['Price']; 

While column index is just faster (I think):

int price = (int)dr[3]; 

Would using column names break if you decide to obfuscate the database?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:39:42+00:00Added an answer on May 11, 2026 at 1:39 am

    I generally prefer readability and understanding over speed. Go with the name. You could (should) use string constants that can be updated in one place if you decide to change database column names.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am retrieving values from a database and displaying it a table using php.
I'm trying to autocomplete a textbox. I'm retrieving values from Access Database. Just one
I am retrieving values from the url with the GET method and then using
Have this dictionay retrieving values from DataTable: Dictionary<string,string> meta= ds.Tables[1].Select(key<>'format').AsEnumerable().ToDictionary(k=>k.Field<string>(0),v=>v.Field<string>(1)); How would I apply
I'm retrieving several values from a sequence, but need to do so twice for
I aldready succed retrieving http values from the web. However, I still rarely have
I am retrieving a list of values from a sharepoint list, which works well
I am retrieving some values from DB in form of ArrayList of 240 size
I have a problem retrieving default values from the settings bundle when first launching
I am retrieving two date time values from the database. Once the value is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.