c#: Deployment.WindowsInstaller.BadQuerySyntaxException: SQL query syntax invalid or unsupported

Multi tool use
Multi tool use


c#: Deployment.WindowsInstaller.BadQuerySyntaxException: SQL query syntax invalid or unsupported



My program is a simple one.



What I want to achieve in this particular method-



I am using Microsoft.Deployment.WindowsInstaller to read through MSI files and create MST.


Microsoft.Deployment.WindowsInstaller



It is failing at below parts of code:


count = (int)database.ExecuteScalar("SELECT COUNT(*) FROM Shortcut");
....
database.Execute("DELETE FROM Shortcut WHERE `Shortcut`.`Target` LIKE '%.chm'");
Console.WriteLine("chm deleted");



The error that I'm getting is:



Unhandled Exception: Microsoft.Deployment.WindowsInstaller.BadQuerySyntaxException: SQL query syntax invalid or unsupported.



Could someone help me with this?





@mjwills It gives same error. All other SQL statements are working fine. I'm having trouble with just these two. Instead of LIKE '%chm' if I give = '<FullName>' it works fine.
– Praveen
Jul 3 at 4:56




2 Answers
2



Windows Installer SQL isn't the same as full SQL - it's a subset, and some things don't work. For example, using Select Count(*) doesn't work in my tests, so may need to iterate through them. Also "like" may not be supported.



Online: As Phil states, the MSI SQL syntax is a sub-set of normal SQL. You can find information on the MSI SQL syntax online here.



Offline: You can also find the MSI SQL Syntax described in the msi.chm help file (Windows Installer SDK) which is installed with the Windows SDK or the WiX toolset (download).


MSI SQL Syntax


msi.chm


Windows SDK


WiX toolset


download



Just search for the help file on disk - or find it in the WiX installation folder if you have WiX installed. The latter is probably much faster and easier than searching the SDK folders.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Ti,YOO c ZIARIpZyMXDkh 3oB,QIy6JCW9p73cVPNvrLS YJ6qinEnX,3RVVyl,y31TDkS7TqdoMnl,pHpNrJ1p
oqqkJbzdes it8VO8B,ygeZpeZh5Dy Qwaw

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications