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. database operation in pages

database operation in pages

Scheduled Pinned Locked Moved C#
databasesysadmin
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.
  • K Offline
    K Offline
    kalyan_2416
    wrote on last edited by
    #1

    hi all i have got a doubt now i have 5 webpages every page has got database operation.. now while using database which way is cheap work to the server 1) opening connection and closing it when ever page requires a database connection or 2)keep it open the database connection and close it when application is getting closed

    M P 2 Replies Last reply
    0
    • K kalyan_2416

      hi all i have got a doubt now i have 5 webpages every page has got database operation.. now while using database which way is cheap work to the server 1) opening connection and closing it when ever page requires a database connection or 2)keep it open the database connection and close it when application is getting closed

      M Offline
      M Offline
      Mustafa Ismail Mustafa
      wrote on last edited by
      #2

      kalyan_2416 wrote:

      now i have 5 webpages

      you might want to try the Asp.Net forum for your web based questions Also, the information regarding the architecture you have is insufficient. Can you enter each page independently of the others? or are they in some sort of order? in either case, its usually better off to abstract your database operations& and therefore connection) to a separate layer.

      "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook "There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib

      1 Reply Last reply
      0
      • K kalyan_2416

        hi all i have got a doubt now i have 5 webpages every page has got database operation.. now while using database which way is cheap work to the server 1) opening connection and closing it when ever page requires a database connection or 2)keep it open the database connection and close it when application is getting closed

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        As long as you have database connections in the pool and you close/dispose of the connections, and you use the same connection string to connect to the database, then option 1 is going to be the better solution. Option 2 means that you have to leave a connection open - which is bad news if the server wants to recycle the database process, or the connection disappears for some reason and you attempt to do a database operation with a connection that is no longer valid. Never design a system that keeps a resource open any longer than it necessarily has to - it just doesn't scale well.

        Deja View - the feeling that you've seen this post before.

        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