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 6564387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:57:37+00:00 2026-05-25T13:57:37+00:00

If I need to get info from a database, items from an invoice, for

  • 0

If I need to get info from a database, items from an invoice, for instance… should I just get the data into a data table, and store them into variables, or should I create a class?

What’s better?

MyClass.ItemNumber;
MyClass.Price;
MyClass.InvoiceNumber;

or…

myItemNumber = (int)dt["itemnumber"];
myPrice = (double)dt["price"];
myInvNum = dt["InvNum"].ToString();

Why? If it’s something I will never have to use anywhere else, are variables fine, or is it beneficial to create a “Invoice Class”? If I get data, store it in a class instance, is it cached for form posts in .Net? Or is each page recreating the class instance/db call, etc.? How about performance? Please explain concepts. The concepts are the hardest thing for me to grasp… coding–easy. Concepts of .Net–not so easy.

  • 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. Editorial Team
    Editorial Team
    2026-05-25T13:57:38+00:00Added an answer on May 25, 2026 at 1:57 pm

    If its for immediate use only, class is definitely an unneeded overhead.

    Your datatable dt is already an entity in the memory with the data. Variables are enough.

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

Sidebar

Related Questions

So this sucks. Trying to populate a core data database with info from NSDictionaries.
I need to get one page (can be cURL, or filegetcontent), get some info
Just need get some vals located in application.ini(main ini) in the Controller plugin I
I need get all items these have no categories int? categoryId = null; var
I am developing an app for android where I need some data from a
I have several laptops in the field that need to daily get information from
I need to get some info passed as a lambda expression to some methods.
I need to be able to bring up a list of items from the
I have to store some info (timestamp of post, title and link) from various
I have a DataGridView populated from a database, and I need to take each

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.