Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Guys,

Am trying to update the MSI database via a transforms (MST) file. using below code.
[code]

WindowsInstaller.Installer inst = (WindowsInstaller.Installer)new Installer();

Database instDb = inst.OpenDatabase(MSIFile.FullName, WindowsInstaller.MsiOpenDatabaseMode.msiOpenDatabaseModeReadOnly);

instDb.ApplyTransform(MSTpath, MsiTransformError.msiTransformErrorViewTransform);

WindowsInstaller.View view1 = instDb.OpenView("INSERT INTO `Registry`(`Registry`,`Root`,`Key`,`Name`,`Value`,`Component_`) VALUES('" + Registry1 + "', '" + Root + "', '" + Key + "', '" + Name1 + "', '" + Value1 + "', '" + Component + "')");


view1.Execute(null);

view1.Close();
instDb.Commit();
[/code]


When i try for MSI database before including instDb.ApplyTransform(MSTpath, MsiTransformError.msiTransformErrorViewTransform);

it worked fine for MSI, the values got updated in the MSI database,
But i face error in the above line of code.

Am i missing something ? please assist.
Posted
Comments
Dave Kreskowiak 1-Sep-14 17:27pm    
Why is it every newb thinks that the error message isn't really important when asking a question about how to fix the error they mention nothing about??
[no name] 1-Sep-14 17:48pm    
Because there is only one error message that covers everything and there is only one possible fix for it?
Richard MacCutchan 2-Sep-14 3:39am    
Am i missing something ?
Yes you are missing telling us what the error message is. We cannot see your computer or read your mind.
thatraja 2-Sep-14 3:56am    
what's the error message?
Mohan Subramani 2-Sep-14 12:46pm    
Sorry guys, for the incomplete question.
"COMException was unhandled
ApplyTransform, TransformFile,ErrorConditions"

for the line "instDb.ApplyTransform(MSTpath, MsiTransformError.msiTransformErrorViewTransform);"

1 solution

Check the datatypes of the values that you are trying to insert.
According to http://msdn.microsoft.com/en-us/library/aa371168(v=vs.85).aspx[^], Root is of type integer, so it shouldn't have quotes around it in the values part of the insert statement.

Also, I believe all column names should be prefixed with the table name in the Installer SQL Syntax, but I don't know if that's mandatory:

C#
"INSERT INTO `Registry`(`Registry`.`Registry`,`Registry`.`Root`,`Registry`.`Key`,`Registry`.`Name`,`Registry`.`Value`,`Registry`.`Component_`) VALUES('" + Registry1 + "', " + Root + ", '" + Key + "', '" + Name1 + "', '" + Value1 + "', '" + Component + "')"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900