[ASP.Net] Connection Pooling ???

Connection Pooling ??? [ASP.Net] - C#/.NET managed - Programmation

Marsh Posté le 09-06-2004 à 19:51:44    

Avec le Connection Pooling activé :
 
J'ai lu que je devais fermer la connexion dès que je m'en servais pas  
 

Take full advantage of connection pooling. To get the most out of connection pooling in ADO.NET, keep the following in mind when developing your ASP.NET applications:
 
Be sure than your connections use the same connection string each time. Connection pooling only works if the connection string is the same. If the connection string is different, then a new connection will be opened, and connection pooling won't be used.
 
   
[g]Only open a connection when you need it, not before.[/g]
 
   
Close your connection as soon as you are done using it.
 
   
Don't leave a connection open if it is not being used.
 
   
Be sure to drop any temporary objects before closing a connection.
 
   
Be sure to close any user-defined transactions before closing a connection.
 
   
Don't use application roles if you want to take advantage of connection pooling.  
[7.0, 2000] Updated 1-2-2004


 
Dois je ouvrir et fermer ma connexion à la base de donnée à chaque fois que je fais une requête même dans la même page?  
 
conn.open()
oreader = ocomm.executereader
ocomm.dispose
oreader.close
oreader.dispose
conn.close()
 
conn.open()
oreader2 = ocomm.executereader2
ocomm.dispose
oreader2.close
oreader2.dispose
conn.close()
 
conn.open()
oreader3 = ocomm.executereader3
ocomm.dispose
oreader3.close
oreader3.dispose
conn.close()
 
 
Ou je fais ça ?  
 
conn.open()
 
oreader = ocomm.executereader
ocomm.dispose
oreader.close
oreader.dispose
 
oreader2 = ocomm.executereader2
ocomm.dispose
oreader2.close
oreader2.dispose
 
oreader3 = ocomm.executereader3
ocomm.dispose
oreader3.close
oreader3.dispose
 
conn.close()
 

Reply

Marsh Posté le 09-06-2004 à 19:51:44   

Reply

Marsh Posté le 09-06-2004 à 22:21:06    

Help !! C'est assez urgent !

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed