Insert into RemoveFile table in MSI

2019-08-04 06:14发布

In order to automate some actions in MSI I have been trying to insert into RemoveFile table using JScript and keep getting errors and since there is not much error description i am not able to figure out the issue in query and the only error that i get when i try to debug using csript is -2147467259 OpenView,SQL,

This is the query that i am using to insert into removefile table, Can anyone please help me figuring out the issue.

"INSERT INTO `RemoveFile` (`FileKey`, `Component_`, `FileName`, `DirProperty`, `InstallMode`) VALUES (`_142D31F52C744D6FB945F01BA06EEFB3`, `C__931358B017AE83C769F5CB9E95BD2401`, `Product version 2.0.lnk`, `DesktopFolder`, 1)

1条回答
姐就是有狂的资本
2楼-- · 2019-08-04 06:45

Have you opened the view on the installer database?

var installer = WScript.CreateObject("WindowsInstaller.Installer");
var database = installer.OpenDatabase(<your-product.msi>,
                                      msiOpenDatabaseModeTransact);

sql = "INSERT INTO `RemoveFile` "
          + "(`FileKey`, `Component_`, `FileName`, "
              + "`DirProperty`, `InstallMode`) "
          + "VALUES ('_142D31F52C744D6FB945F01BA06EEFB3', "
                   + "'C__931358B017AE83C769F5CB9E95BD2401', "
                   + "'Product version 2.0.lnk', 'DesktopFolder', 1)";
view = database.OpenView(sql);
view.Execute();
view.Close();
查看更多
登录 后发表回答