Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Clonning a connection
Message
De
16/04/2007 14:50:23
 
 
À
16/04/2007 13:51:56
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01215928
Message ID:
01216438
Vues:
23
>How about creating a new connection and pass the same connection string to the constructor?
>
>
>SqlConnection NewCon = new SqlConnection(globalSqlConnection.ConnectionString);
>
>Dim NewCon as New SqlConnection(globalSqlConnection.ConnectionString)
>
I believe this is what I had before I made the change. I had something like this:
                    oCommand.Connection = oApp.aConnection(nConnectionString, 2)
But, assigning the application connection to oCommand.Connection was making it to be used globally and collisions were presents. So, I change to this:
                ' Get the proper definition as per the current scope
                If oProcess Is Nothing Then
                    oCommand.Connection = oApp.aConnection(nConnectionString, 2)
                Else
                    oCommand.Connection = oProcess.aConnection(nConnectionString, 2)
                End If
Where oProcess is the connection object which is created at every hit so no collision can occur.

Or, is there a way for me to go back to the old approach and use your approach so I will avoid creating a connection object at every hit? Because, doing that slows down the process by 0.03 second.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform