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. Global database declaration

Global database declaration

Scheduled Pinned Locked Moved ASP.NET
databasehelpquestion
3 Posts 2 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.
  • A Offline
    A Offline
    Aaron Hudson
    wrote on last edited by
    #1

    Is there any way of being able to open a database at the begging on a page, and close it at the end, where "#include file=..." have been used? I'm currently having problem with declaration blocks etc? I've been told the global.asax however this hasn't worked

    C 1 Reply Last reply
    0
    • A Aaron Hudson

      Is there any way of being able to open a database at the begging on a page, and close it at the end, where "#include file=..." have been used? I'm currently having problem with declaration blocks etc? I've been told the global.asax however this hasn't worked

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      You would be better creating a DAL that maintains the connection information then for each database query have it open the connection, process the query, and then close the connection. You can then share the DAL across many pages which removes your need to store any kind of database information in the page classes.


      Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website

      A 1 Reply Last reply
      0
      • C Colin Angus Mackay

        You would be better creating a DAL that maintains the connection information then for each database query have it open the connection, process the query, and then close the connection. You can then share the DAL across many pages which removes your need to store any kind of database information in the page classes.


        Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website

        A Offline
        A Offline
        Aaron Hudson
        wrote on last edited by
        #3

        Thanks for you reply, I'm not too keen on the concept from what I've looked into. I'm very old fashioned about databases and tend to use a classic ASP approach. Any suggestions on how I could use simply a globally declared application, or what the rules and capabilities are surrounding shared variables using "#include", because some pages share variables from one page to the next, but others don't. Cheers

        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