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. Data bond problem

Data bond problem

Scheduled Pinned Locked Moved ASP.NET
databasehelp
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.
  • I Offline
    I Offline
    Irfan x
    wrote on last edited by
    #1

    HI I have made custom dropdown controls which load data from DB one page have many contols when pages is render each control load data from DB. Each control has its own connection close method If there are 5 controls on page on load FIVE time DB connection open & close this is implemented in control class its not good approach to open & close DB connection each time PLZ GIVE ME SOME GOOD SOLUTION thanks Irfan

    N I 2 Replies Last reply
    0
    • I Irfan x

      HI I have made custom dropdown controls which load data from DB one page have many contols when pages is render each control load data from DB. Each control has its own connection close method If there are 5 controls on page on load FIVE time DB connection open & close this is implemented in control class its not good approach to open & close DB connection each time PLZ GIVE ME SOME GOOD SOLUTION thanks Irfan

      N Offline
      N Offline
      Neel07
      wrote on last edited by
      #2

      Instead of opening & closing multiple times database connection you can define mutiple dataset based on number of controls and open a connection once in the load event populate all the datasets based on different sql query for populating different controls and once you finish then close the database connection. Now you can bind corresponding dataset to different controls. Hope this way you can avoid mutiple database trip and a performance gain as well Share knowledge to enhance your learning

      I 1 Reply Last reply
      0
      • I Irfan x

        HI I have made custom dropdown controls which load data from DB one page have many contols when pages is render each control load data from DB. Each control has its own connection close method If there are 5 controls on page on load FIVE time DB connection open & close this is implemented in control class its not good approach to open & close DB connection each time PLZ GIVE ME SOME GOOD SOLUTION thanks Irfan

        I Offline
        I Offline
        Ista
        wrote on last edited by
        #3

        Actally opening a connection that much is not a problem. But, I would say there is a problem with how your doing it. Have the class cache the data. A Dataset is overkill but some think its the best so cache the data how you want. I use classes personall;y and run from the word "Dataset". Its bulky and unneeded. But get the data once to limit roundtrips to the server. I you use a class hierachy each class would open its connection and grab the data. Since you can use a connection pool it shouldn't hurt the server too much. If this is a high traffic sight then other solution would be needed. Nick 1 line of code equals many bugs. So don't write any!!

        1 Reply Last reply
        0
        • N Neel07

          Instead of opening & closing multiple times database connection you can define mutiple dataset based on number of controls and open a connection once in the load event populate all the datasets based on different sql query for populating different controls and once you finish then close the database connection. Now you can bind corresponding dataset to different controls. Hope this way you can avoid mutiple database trip and a performance gain as well Share knowledge to enhance your learning

          I Offline
          I Offline
          Irfan x
          wrote on last edited by
          #4

          Thanks Actually I have many tables and for each table I have made dropdown control to load data. (you can say these are lookup tables)

          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