SIngle Connection

Results 1 to 3 of 3

Thread: SIngle Connection

  1. #1
    Kiran Shiveshwar Guest

    Default SIngle Connection

    I have a query about Connection this time.<BR><BR>I wanted to open a connection (In ADO) and use the same connection in all my ASP pages.Can you please tell me how to achieve this.I tried opening a connection in Session_onStart in Global.asa file, but its scope is not active in other ASP pages.<BR>

  2. #2

    Default RE: SIngle Connection

    Its not a real good idea to store a connection object in a session. There are a few good reasons why you dont want to do this, one being it nails the server the whole time the user is connected. <BR><BR>If you want to use the same connection string in every page, just use a file #include at the top with a few functions in it. Be sure to close it when your finished getting your data. Again do this by using a function in your include file.<BR><BR>Here is a good link about sessions and storing objects.<BR><BR><BR>Include file functions:<BR>Sub OpenDataConn()<BR> Set objDataConn = Server.CreateObject("ADODB.Connection")<BR> objDataConn.Open <BR>End Sub<BR><BR>Sub CloseDataConn()<BR> objDataConn.Close<BR> Set objDataConn = Nothing<BR>End Sub<BR><BR>Just my 2 cents...<BR>

  3. #3
    Kiran Shiveshwar Guest

    Default RE: SIngle Connection

    Hi,<BR>Thanks for the reply. Here are 2 cents **<BR>But I wanted to use this connection for transaction.If I open a a connection in an ASP page, this connection won&#039t be active in other ASP page and then I cannot commit or rollback the transaction.<BR><BR>Normally how is the transaction handled in ASP.<BR><BR>Regards.<BR><BR>Kiran

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts