Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Clonning a connection
Message
De
16/04/2007 13:51:56
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
 
 
À
14/04/2007 10:30:57
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:
01216396
Vues:
23
>I have a global connection object which I use for all my data access. So, this is much faster. However, sometimes, if two transactions are hitting the Web site at the same time, one could receive an object not a reference error. So, I thought about the idea of obtaining a reference to that global connection object. The reference to it always work, even when two simultaneous hits happen. It is just later down below in the data access, such as a ExecuteReader() or Dataset.Fill() command that I can have this situation. So, once the reference is done, if I can obtain a clone copy of the connection and use that instead, the problem would go away. But, for a connection object, the Clone() method is not available. Anyone knows a workaround?

Michel,

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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform