DROP CONNECTIONS OF DATABASE
Fabian Kneubuehl
support at ysd.ch
Tue Mar 20 09:36:05 CDT 2012
Does not work! Here my code:
Call DBOpen(DBName)
Call myDB.SqlExecute("CLONE DATABASE TO '" + StrExch(DBFolder + DBName +
"_BAK", "\", "\\") + "'")
Call DBClose
Call DBKillConnections(DBName)
Call DBUnRegisterServer(DBName)
DelFiles DBFolder + DBName + ".VDB" 'Files are still open
and cannot be deleted!
DelFiles DBFolder + DBName + ".BLB"
DelFiles DBFolder + DBName + ".DAT"
DelFiles DBFolder + DBName + ".IND"
'-----------------------------------------------------------------
Private Sub DBKillConnections(Optional ByVal DBName As String = "")
Dim myServer As VServer
Dim Connection As VConnection
Set Connection = New VConnection
Set myServer = New VServer
Connection.Init GetMachineName(), "sa", "sa", Port, , CONNECTIONINITID
Connection.Open
myServer.Init Connection
If DBName = "" Then DBName = DBFILENAMERAW
Call Connection.SqlExecute("DROP CONNECTIONS OF DATABASE " + DBName)
Connection.Close
Set Connection = Nothing
Set myServer = Nothing
End Sub
'-----------------------------------------------------------------
Private Sub DBUnRegisterServer(Optional ByVal DBName As String = "")
Dim myServer As VServer
Dim Connection As VConnection
Set Connection = New VConnection
Set myServer = New VServer
Call myValentina.InitClient(10& * 1024& * 1024&)
myValentina.DebugLevel = kLogNothing
Connection.Init GetMachineName(), "sa", "sa", Port, , CONNECTIONINITID
Connection.Open
myServer.Init Connection
If DBName = "" Then DBName = DBFILENAMERAW
Call myServer.UnregisterDatabase(DBName)
Connection.Close
Set Connection = Nothing
Set myServer = Nothing
End Sub
Anything wrong with this?
Thanks and regards
Fabian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macserve.net/pipermail/valentina/attachments/20120320/a4ae58a4/attachment-0001.html>
More information about the Valentina
mailing list