Dear Team,
I am facing a problem of connection still in use after clearing the pool and
dispose connection objectbut as i close the vb.net application it free the
database connection and i can rename the database manually which i want to do
at run time
Code as belowImports System.DataImports System.Data.SqlClientImports
FirebirdSql.Data.FirebirdClient'Imports FirebirdSql.Data.Firebird
Imports System.Windows.FormsImports System.IOImports System.TextImports
System.Globalization
Public myConnection As New FbConnection
Public Function OpenConnection(Optional ByVal ByPass_Message As Boolean =
False) As Boolean Dim strConString As String = ""
Try If myConnection.State = ConnectionState.Closed Then
Dim fbConn As New FbConnectionStringBuilder()
fbConn.Password = Password fbConn.UserID = UserID
fbConn.Pooling = True fbConn.Role = "sysadmin"
fbConn.MaxPoolSize = 20 'fbConn.ClientLibrary =
"fbclient.dll" If Is_Local_Connection = True Then
fbConn.Database = strLocalDatabase Else
fbConn.Database = Database_Path
End If
fbConn.DataSource = DB_Server
fbConn.ConnectionLifeTime = 0 fbConn.ConnectionTimeout = 30
fbConn.Charset = "UTF8" fbConn.ServerType =
ServerType fbConn.Dialect = 3
If Val(strPort) = 0 Then strPort = 3050
End If fbConn.Port = strPort
strConString = fbConn.ToString()
myConnection.ConnectionString = fbConn.ToString
If fbConn IsNot Nothing Then fbConn = Nothing
End If myConnection.Open()
End If Return True Catch ex As Exception
If ByPass_Message = False Then WriteError(ex.ToString() &
vbCrLf & "DB Path :" & Database_Path & "," & vbCrLf & "Local DB:" &
strLocalDatabase & vbCrLf & "Conn String:" & Replace(strConString, Password,
"")) MessageBox.Show("Path is not valid...Please,check data
direcotry setting...!" & vbCrLf & vbCrLf & _ ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End If
Return False End Try End FunctionSub
Rename_DBmyConnection.ClearAllPools()
FbConnection.ClearPool(myConnection) FbConnection.ClearAllPools()
myConnection.Close()
'AppDomain.Unload(AppDomain.CurrentDomain) myConnection.Dispose()
myConnection = Nothing
IO.File.Replace(txtFile_Path.Text, strCurrent_Database_Path,
"D:\Backup\Bkp.fdb")--this line is giving error file in used
End Sub
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider