|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SQLConnection best way to useDatabase. I use a global variabe for my connection declare in a module (VB.Net code behind) All is ok but when I start a form from the default page it takes 30 seconds to show the resultat of a select request And when, during this 30 seconds, a another user want open a another forms from the default page, I have an error : "Connection are already open" I think it 's because I use the connection variable globally. Any idea to use the best way the connection object in a ASP.net project ? Hi,
Store just connection string, create and open connection instance as late as posible and close/dispose asap. Don't worry of connection time penality - connection pooling will handle this. -- Show quoteMiha Markic [MVP C#] - RightHand .NET consulting & development SLODUG - Slovene Developer Users Group www.rthand.com "bnob" <massimo.capet***@freesurf.ch> wrote in message news:ub0Jrqi3EHA.1188@tk2msftngp13.phx.gbl... > Im my ASP.net project I do a lot of connection to the SQL Server > Database. I use a global variabe for my connection declare in a module > (VB.Net code behind) > > All is ok but when I start a form from the default page it takes 30 > seconds to show the resultat of a select request > > And when, during this 30 seconds, a another user want open a another > forms from the default page, I have an error : "Connection are already > open" > > I think it 's because I use the connection variable globally. > > Any idea to use the best way the connection object in a ASP.net project > ? > > -- > Ceci est une signature automatique de MesNews. > Site : http://www.mesnews.net > > Yup . . and do all that operation thru a dataaccess layer - that way you'd
ensure that nobody breaks the rules. Connection Pooling will work as long as the connection string is EXACTLY the same - so put that in the config file and read it from there. - Sahil Malik http://dotnetjunkies.com/weblog/sahilmalik Show quote "Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:u8zbR7i3EHA.3624@TK2MSFTNGP14.phx.gbl... > Hi, > > Store just connection string, create and open connection instance as late as > posible and close/dispose asap. > Don't worry of connection time penality - connection pooling will handle > this. > > -- > Miha Markic [MVP C#] - RightHand .NET consulting & development > SLODUG - Slovene Developer Users Group > www.rthand.com > > "bnob" <massimo.capet***@freesurf.ch> wrote in message > news:ub0Jrqi3EHA.1188@tk2msftngp13.phx.gbl... > > Im my ASP.net project I do a lot of connection to the SQL Server > > Database. I use a global variabe for my connection declare in a module > > (VB.Net code behind) > > > > All is ok but when I start a form from the default page it takes 30 > > seconds to show the resultat of a select request > > > > And when, during this 30 seconds, a another user want open a another > > forms from the default page, I have an error : "Connection are already > > open" > > > > I think it 's because I use the connection variable globally. > > > > Any idea to use the best way the connection object in a ASP.net project > > ? > > > > -- > > Ceci est une signature automatique de MesNews. > > Site : http://www.mesnews.net > > > > > > |
|||||||||||||||||||||||