Mohan S

Mohan S

  • NA
  • 34
  • 38.9k

Issues with updating a MSI Database

Jun 3 2014 4:18 PM
Hello Guys,
Am writing a C# code to add values to MSI file Database.
Below is my code:
Used "Button" - Add (windows Form Application)
private void btApply_Click(object sender, EventArgs e)
{
FileInfo msiFile = new FileInfo(@"C:\temp\WinInstaller\Sample.Msi");
// open MSI database
WindowsInstaller.Installer inst = (WindowsInstaller.Installer)new Installer();
Database instDb = inst.OpenDatabase(msiFile.FullName, WindowsInstaller.MsiOpenDatabaseMode.msiOpenDatabaseModeTransact);
// query the database
WindowsInstaller.View view = instDb.OpenView("INSERT INTO Property (Property, Value) Values( 'Manufacturer', 'MyCompany')");
view.Execute(null);
view.Close();
}
When i run the code, i can click on Button - "Add" which executes with no error.
My MSI file time stamp also gets updated.
But changes are not getting reflected.
Please help.
Cheers,

Answers (1)