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. Web Development
  3. ASP.NET
  4. DataReader or Dataset

DataReader or Dataset

Scheduled Pinned Locked Moved ASP.NET
database
3 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.
  • P Offline
    P Offline
    pssuresh
    wrote on last edited by
    #1

    I have 10 comboboxes and 10 textboxes in my aspx page.Each combobox has to be filled with 50 values.so if we calculate total records it comes around 510.Most of the articles says that datareader is faster than dataset.But since i have more controls and more values, it has to go to database again and again to fetch values. I can use stored procedure and fill the dataset at once, so that i can avoid the roundtrip. Guys can you tell me which one is better in this situation dataset or datareader and if possible the reason. Thanks

    M S 2 Replies Last reply
    0
    • P pssuresh

      I have 10 comboboxes and 10 textboxes in my aspx page.Each combobox has to be filled with 50 values.so if we calculate total records it comes around 510.Most of the articles says that datareader is faster than dataset.But since i have more controls and more values, it has to go to database again and again to fetch values. I can use stored procedure and fill the dataset at once, so that i can avoid the roundtrip. Guys can you tell me which one is better in this situation dataset or datareader and if possible the reason. Thanks

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Are you trying the DataReader with multiple results? I'm not sure which one is better in your case, you may create some benchmarks and investigate. However, if they don't produce any significant difference, then both are applicable.

      1 Reply Last reply
      0
      • P pssuresh

        I have 10 comboboxes and 10 textboxes in my aspx page.Each combobox has to be filled with 50 values.so if we calculate total records it comes around 510.Most of the articles says that datareader is faster than dataset.But since i have more controls and more values, it has to go to database again and again to fetch values. I can use stored procedure and fill the dataset at once, so that i can avoid the roundtrip. Guys can you tell me which one is better in this situation dataset or datareader and if possible the reason. Thanks

        S Offline
        S Offline
        simple one
        wrote on last edited by
        #3

        hi, I had similar situation and I ended up using the datareader option with multiple result sets from the database. From my own observations the datareader option seemed to be faster. Since I was only reading this data into objects on the web page- then there was no nead for the extra functionality in the Dataset. to parse the data into the comboboxes(DropDownList) and textboxes I used while loops and the .NextResult() method. Wherever the data in some of the the combo boxes was identical (I had 2 combo boxes with this scenario)- then I used a while loop to read the values into a listItem object then I added it to the two combo boxes. here is an example of this below... (N.B. dr is my datareader object) while (dr.Read()) { ListItem NewItem =new ListItem(); NewItem.Value =dr.GetInt32(0).ToString(); //first column in data NewItem.Text =dr.GetString(1); //second column in data combo1.Items.Add(NewItem); combo2.Items.Add(NewItem); } hope this helps.:-D simple one

        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