Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Clonning a connection
Message
From
16/04/2007 14:50:23
 
 
To
16/04/2007 13:51:56
Keith Payne
Technical Marketing Solutions
Florida, United States
General information
Forum:
ASP.NET
Category:
Databases
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01215928
Message ID:
01216438
Views:
24
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform