PaulZ
Active member
In my program I check the version of the MSI-file that belongs to my program.
When it has changed, I must do an update. So far so good.
But:
I read the version with the following code:
-- begin ---
Sub Check
Dim installer
installer = CreateObject("WindowsInstaller.Installer")
Dim db As WindowsInstaller.Database
Dim dbView As WindowsInstaller.View
Dim vwRecord As WindowsInstaller.Record
Dim vwSQL As String
db = installer.OpenDatabase(MsiPath, 0) MsiPath = network-msi, 0=readonly
vwSQL = "SELECT Value FROM Property WHERE Property = ProductVersion"
dbView = db.OpenView(vwSQL)
dbView.Execute()
vwRecord = dbView.Fetch
InstallerVersion = Trim(vwRecord.StringData(1)) & ".00000" InstallerVersion = a global variable
vwRecord = Nothing
dbView.Close()
dbView = Nothing
db = Nothing
installer = Nothing
End Sub
-- end --
Problem:
As soon as the installer.OpenDatabase statement is done, a network-lock is set at the msi-file telling me that I have that file opened.
After the end of the sub, I expect the msi-file to be released, but that is not the case. It is only released when my program ends. Because my program always runs (and always has the lock on the msi), I can not copy a newer msi to the network (msi already in use by ...).
You might say, stop your program and do the copy, but I am not the only user of my program (about 250 users) and I cant stop all of them.
Does anyone have an idea how to release the msi at the end of the sub?
Thanks in advance,
Paul
When it has changed, I must do an update. So far so good.
But:
I read the version with the following code:
-- begin ---
Sub Check
Dim installer
installer = CreateObject("WindowsInstaller.Installer")
Dim db As WindowsInstaller.Database
Dim dbView As WindowsInstaller.View
Dim vwRecord As WindowsInstaller.Record
Dim vwSQL As String
db = installer.OpenDatabase(MsiPath, 0) MsiPath = network-msi, 0=readonly
vwSQL = "SELECT Value FROM Property WHERE Property = ProductVersion"
dbView = db.OpenView(vwSQL)
dbView.Execute()
vwRecord = dbView.Fetch
InstallerVersion = Trim(vwRecord.StringData(1)) & ".00000" InstallerVersion = a global variable
vwRecord = Nothing
dbView.Close()
dbView = Nothing
db = Nothing
installer = Nothing
End Sub
-- end --
Problem:
As soon as the installer.OpenDatabase statement is done, a network-lock is set at the msi-file telling me that I have that file opened.
After the end of the sub, I expect the msi-file to be released, but that is not the case. It is only released when my program ends. Because my program always runs (and always has the lock on the msi), I can not copy a newer msi to the network (msi already in use by ...).
You might say, stop your program and do the copy, but I am not the only user of my program (about 250 users) and I cant stop all of them.
Does anyone have an idea how to release the msi at the end of the sub?
Thanks in advance,
Paul