Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to update Media table in msi file through QDatabase #4692

Open
wixbot opened this issue Mar 5, 2015 · 1 comment
Open

Unable to update Media table in msi file through QDatabase #4692

wixbot opened this issue Mar 5, 2015 · 1 comment
Milestone

Comments

@wixbot
Copy link

wixbot commented Mar 5, 2015

Unable to update Media table in msi file through QDatabase. This code:

using (var package = new QDatabase(packagePath, DatabaseOpenMode.Transact))
{
    var media = package.Medias.Where(m => m.DiskId == 1).AsEnumerable().First();
    Console.WriteLine(media.LastSequence);
    media.LastSequence = 20;

    package.Commit();
}

throws exception:

Microsoft.Deployment.WindowsInstaller.InstallerException: Function failed during execution.
   at Microsoft.Deployment.WindowsInstaller.View.Execute(Record executeParams)
   at Microsoft.Deployment.WindowsInstaller.Database.Execute(String sql, Record record)
   at Microsoft.Deployment.WindowsInstaller.Linq.QRecord.Update(IList`1 indexes, IList`1 values)
   at Microsoft.Deployment.WindowsInstaller.Linq.Entities.Media_.set_LastSequence(Int32 value)

at line:

media.LastSequence = 20;

This code works fine:

using (var package = new Database(packagePath, DatabaseOpenMode.Transact))
{
    package.Execute("UPDATE Media SET LastSequence = ? WHERE DiskId = ?", new Record(20, 1));
    package.Commit();
}

And this code also works:

using (var package = new QDatabase(packagePath, DatabaseOpenMode.Transact))
{
    var file = package.Files.Where(f => f.File == "SQLWizard.exe").AsEnumerable().First();
    file.Version = "Hello, World!!!";

    package.Commit();
}

Originally opened by bogser

@wixbot
Copy link
Author

wixbot commented Mar 10, 2015

Release changed from v3.9 to v3.x

@wixbot wixbot added this to the v3.x milestone Dec 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant