Connection Object

Results 1 to 2 of 2

Thread: Connection Object

  1. #1
    Join Date
    Dec 1969

    Default Connection Object

    I have a web application that uses the Microsoft Data Application Block. After the Data Application Block finishes it&#039;s task, I close the connection so it will be returned to the connection pool. The reason I close it is because I am not passing the connection string to the Application Block. Instead, I am passing a SQL Transaction object, SQL parameter array and the stored procedure name (SQL Server 2000). I was stepping through the code to see if the connection object is closing, however, it doesn&#039;t seem to close when I am watching it in my watch window. Is this the way is suppose to work? I just want to make sure my connection is returned to the connection pool. Is there a way to monitor how many connection are not in the pool?<BR><BR>Thanks,<BR><BR>James

  2. #2

    Default RE: Connection Object

    Create the transaction object in a using block<BR><BR>using(SqlTransaction trans = new SqlTransactio())<BR>{<BR>...the code<BR><BR>}<BR><BR>If you look into the block, you will see that they make extensive use of the using block.<BR>It is part of the Dispose pattern and it makes sure the object gets disposed.

Posting Permissions

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