i trying run sql queries on msi database in c#.but seems specific sql queries not working.
windowsinstaller.installer ins = (windowsinstaller.installer)new installer(); string strfilemsi = @"abc.msi"; database db3 = ins.opendatabase(strfilemsi, windowsinstaller.msiopendatabasemode.msiopendatabasemodedirect); string q = "select file file filename '%s%'"; windowsinstaller.view vw = db3.openview(q); vw.execute(null); string q2="select * instalexecutesequece order sequence desc" windowsinstaller.view vw2 = db.openview(q2); vw.execute(null);
if run same query without desc keyword , all,it works fine.similarly case like keyword also.all of these gives sql exception.
windows installer implements subset of sql described in sql syntax. within subset there several limitations, including 3 i'll highlight here:
- there no support
desc
orlike
, ,order by
may not handle strings expect - update queries cannot modify value in primary key column
- there no way escape apostrophe character ' in sql query. if need match string value
'it's'
, have use question mark ? placeholder in query , pass record containing valueview.execute(record)
Comments
Post a Comment