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. How to Use Session Level Connection

How to Use Session Level Connection

Scheduled Pinned Locked Moved Web Development
databasetutorial
2 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.
  • P Offline
    P Offline
    Pradhip
    wrote on last edited by
    #1

    Hi Folks: I have about 7-8 Pages which all connect to the same database but then generate different record sets with different queries.. So i tried giving only my connection object defnition and opening the connection in global.asa file and then using it in the other asp pages as:- objCommand.activeConnection=session("objconn") OR objRS.OPEN(QUERYSTRING,objConn") but then i am told the paramters im passing are wrong.And so i dont understand how.. Can somebody tell me if im making some fundamental mistake or is it just the code that i have to go through..:-D Why Need Parking lots in Bars when Drunken Driving is Prohibited

    C 1 Reply Last reply
    0
    • P Pradhip

      Hi Folks: I have about 7-8 Pages which all connect to the same database but then generate different record sets with different queries.. So i tried giving only my connection object defnition and opening the connection in global.asa file and then using it in the other asp pages as:- objCommand.activeConnection=session("objconn") OR objRS.OPEN(QUERYSTRING,objConn") but then i am told the paramters im passing are wrong.And so i dont understand how.. Can somebody tell me if im making some fundamental mistake or is it just the code that i have to go through..:-D Why Need Parking lots in Bars when Drunken Driving is Prohibited

      C Offline
      C Offline
      Chris Rickard
      wrote on last edited by
      #2

      fundamental mistake: Placing an open connection object is about the quickest way to bring a web server to its knees. I suggest placing only the connection string in the application object (assuming the connection string does not change throughout the lifetime of the application) this will give you something like thus: Global.asa

      Sub application_onstart
      application("constring")="PROVIDER=SQLOLEDB;SERVER=localhost;DATABASE=pubs;uid=sa;pwd=;"
      end sub

      anASPPage.asp

      ...
      objRS.Open QUERYSTRING,Application("constring")

      Or to go one step further in conserving resources:

      objCon.Open Application("constring")
      objRS.Open QUERYSTRING,objCon
      ...
      objRS.Close
      objCon.Close

      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