Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. best way of using dataset object

best way of using dataset object

Scheduled Pinned Locked Moved C#
csharpperformancetutorialquestionannouncement
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    haseeb_saeed
    wrote on last edited by
    #1

    Hello....i've been working in ado.net for a few months now... and am quite confused how to use the dataset object. though i know it depends on what type of project a person is upto but still i wanted to know which one is the better approach to usin the datasets... Approach 1: fill the dataset with all tables at project load and use the dataset for all searches and things. though as sqlserver is locally placed, i update the sqlserver tables as soon as i update the data set... Approach 2: fill dataset with only the rows that are required... ie if u need some rows according to a criteria, write a select statement, discard ur present dataset and refil it with this statement... Please provide full information,based on performance issues of a system... as far as i think , i believe approach1 will be better but it becomes hard to handle when u have more tables, like 60 tables... so wat should be done in this case, "A dataset for every 10 tables"? or wat... Thanx haseeb haseeb

    haseeb

    A P 2 Replies Last reply
    0
    • H haseeb_saeed

      Hello....i've been working in ado.net for a few months now... and am quite confused how to use the dataset object. though i know it depends on what type of project a person is upto but still i wanted to know which one is the better approach to usin the datasets... Approach 1: fill the dataset with all tables at project load and use the dataset for all searches and things. though as sqlserver is locally placed, i update the sqlserver tables as soon as i update the data set... Approach 2: fill dataset with only the rows that are required... ie if u need some rows according to a criteria, write a select statement, discard ur present dataset and refil it with this statement... Please provide full information,based on performance issues of a system... as far as i think , i believe approach1 will be better but it becomes hard to handle when u have more tables, like 60 tables... so wat should be done in this case, "A dataset for every 10 tables"? or wat... Thanx haseeb haseeb

      haseeb

      A Offline
      A Offline
      Andrei Ungureanu
      wrote on last edited by
      #2

      This depends on the type of application you want to write. It's a good practice to minimize the queries to a database when you write a web application. But still, my opinion is that it's not a good practice to read all the data from the database into a dataset. What happens when you have around 50-60 tables and each table has 50.000 or more rows. In this case you do a huge waste of memory. I think it's better practice to save into a dataset all the data needed at a certain time. This is my opinion.

      I will use Google before asking dumb questions

      H 1 Reply Last reply
      0
      • H haseeb_saeed

        Hello....i've been working in ado.net for a few months now... and am quite confused how to use the dataset object. though i know it depends on what type of project a person is upto but still i wanted to know which one is the better approach to usin the datasets... Approach 1: fill the dataset with all tables at project load and use the dataset for all searches and things. though as sqlserver is locally placed, i update the sqlserver tables as soon as i update the data set... Approach 2: fill dataset with only the rows that are required... ie if u need some rows according to a criteria, write a select statement, discard ur present dataset and refil it with this statement... Please provide full information,based on performance issues of a system... as far as i think , i believe approach1 will be better but it becomes hard to handle when u have more tables, like 60 tables... so wat should be done in this case, "A dataset for every 10 tables"? or wat... Thanx haseeb haseeb

        haseeb

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        Datasets are best used to hold DataTables that have Relationships, I very rarely use a DataSet.

        1 Reply Last reply
        0
        • A Andrei Ungureanu

          This depends on the type of application you want to write. It's a good practice to minimize the queries to a database when you write a web application. But still, my opinion is that it's not a good practice to read all the data from the database into a dataset. What happens when you have around 50-60 tables and each table has 50.000 or more rows. In this case you do a huge waste of memory. I think it's better practice to save into a dataset all the data needed at a certain time. This is my opinion.

          I will use Google before asking dumb questions

          H Offline
          H Offline
          haseeb_saeed
          wrote on last edited by
          #4

          lolz... cool answer... or should i say, read my whole question first and then try answering... i have already said of making small datasets (at the end of my question)... max of 10 tables... which means max of 10 tables when data is less and it can go upto as small dataset as of one table... Also those tables should be related to each other... now i can go on making datasets only for one row in a table and i have seen ppl doin it...and when i code, i use a single dataset for related data that is required... now i can't go on making dataset for 10 rows or 20 rows coz that won't help the cause of disconnected environment even a lil bit. Anyways from ur answer, i feel i have a better sense than u atleast...and please don't consider answering again... **"i would think 10 times, before giving others answers that would give the impression that i am very smart..."...**LOLZ

          haseeb

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups