Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to know what makes the database non restorable
Message
De
24/03/2017 10:33:56
 
 
À
23/03/2017 19:17:45
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Versions des environnements
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows Server 2012
Database:
Visual FoxPro
Application:
Web
Divers
Thread ID:
01649277
Message ID:
01649301
Vues:
41
>My data class calls a method to get the schema. It had this:
>
>
>Using loSQLConnection As New SqlConnection(oApp.aConnection(nConnectionString, 1))
>   loSQLConnection.Open()
>   oCommand.Connection = loSQLConnection
>   oDataReader = oCommand.ExecuteReader(CommandBehavior.SchemaOnly)
>   oDataTable = oDataReader.GetSchemaTable
>End Using
>
>
>The loSQLConnection.Open() was not necessary. Once removed, no connectivity remained.
>
>The updated code is as follow:
>
>
>Using loSQLConnection As New SqlConnection(oApp.aConnection(nConnectionString, 1))
>   loSQLConnection.Open()
>   oCommand.Connection = loSQLConnection
>   oDataReader = oCommand.ExecuteReader(CommandBehavior.SchemaOnly)
>   oDataTable = oDataReader.GetSchemaTable
>End Using
>
>
>But, later on, still in the DataAdapter.Fill() command, this applies a permanent connection to something.
>
>
>Using loSQLConnection As New SqlConnection(oApp.aConnection(nConnectionString, 1))
>   oCommand.Connection = loSQLConnection
>   oDataAdapter.Fill(oDataSet)
>End Using
>
>
>When that command executes, something remains stuck in memory. I have tried, oCommand.Connection.Close(), oCommand.Dispose(), oDataAdapter = Nothing and all of that at the same time.
>
>Do you see anything in there that is missing?

IIRC ADO.NET maintains a connection pool and your new SqlConnection() will just grab (or release) an existing connection from the pool. I think there's a ClearPool method - check this:
https://msdn.microsoft.com/en-us/library/8xx3tyca(v=vs.110).aspx
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform