See
www.betav.com/blog/billva and search for "pooling" or "connecting".
hth
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit
www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"Sylvie" <(E-Mail Removed)> wrote in message
news:%23xB$(E-Mail Removed)...
>I have a static function in a class, everytime I call this function, I am
> creating a SQLconnection, open it, use it, and null it, All my functions
> and
> application logic is like this,
>
> Every connection is creating self connection object and null it after the
> some process,
>
> Is this wrong ?
>
> One of my friend told me about "Connection Pooling", and I am confused
> enough, Only one connection can be used in all part of the applicaton
> (whether web or windows application)
>
> //
>
> using System.Data;
>
> using System.Data.SqlClient;
>
> using System.Configuration;
>
> using System.Web;
>
> using System.Web.Security;
>
> using System.Web.UI;
>
> using System.Web.UI.WebControls;
>
> using System.Web.UI.WebControls.WebParts;
>
> using System.Web.UI.HtmlControls;
>
> public class Langs
>
> {
>
> public Langs()
>
> {
>
> }
>
> public static void GetLanguageList()
>
> {
>
> SqlConnection ConnLocal = new
> SqlConnection(DataFace.GetSQLConnectionString());
>
> try
>
> {
>
> SqlCommand CommLocal = new SqlCommand();
>
> CommLocal.Connection = ConnLocal;
>
> CommLocal.CommandText += "SELECT bla bla bla";
>
> ConnLocal.Open();
>
> SqlDataReader rdLocal =
> CommLocal.ExecuteReader(CommandBehavior.CloseConnection);
>
> if (rdLocal.HasRows)
>
> {
>
> while (rdLocal.Read())
>
> {
>
> }
>
> if (rdLocal.IsClosed != false)
>
> {
>
> rdLocal.Close();
>
> }
>
> }
>
> catch (Exception Exx)
>
> {
>
> throw Exx
>
> }
>
> finally
>
> {
>
> ConnLocal = null;
>
> }
>
> }
>
> }
>
>
>