I am new to WIX and I need to know that can we modify the SQL script used for
database creation during the installation process?

The SQL Script which is referred using Binary element and I need to carry
out some text replacement in the SQL script with the user Input string.

I am able to read the SQL Script text from the WIX database query but not
able to update it.
Reading the text from the Binary file as:

View v = session.Database.OpenView("SELECT `Data` FROM `Binary` WHERE `Name`
= '{0}'", binaryKeyName); // Binary key name is the sript file name
v.Execute();
Record r = v.Fetch();

//Carry out the text replace operation

   StreamReader reader = new StreamReader(r.GetStream("Data"));
                var text = reader.ReadToEnd();
                text = text.Replace(Old, new);

                byte[] byteArray = Encoding.ASCII.GetBytes(text);
                MemoryStream stream = new MemoryStream(byteArray);

//Trying to update the wix database and getting the error

 if (r != null) r.Close();
                if (v != null) v.Close();

                Database db = null;
                View view = null;
                Record rec = null;
                try
                {

                    view = session.Database.OpenView("UPDATE `Binary` SET
`Data` = ? WHERE `Name` = '{0}'", binaryKeyName);
                    rec = new Record(1);
                    rec.SetStream(1, stream);
                    view.Execute(rec);
                    db.Commit();
                }
                catch(Exception ex)
                {

                }

So,please provide a solution if it is possible to modify the Binary file in
WIX during installation.

Thanks

Supriya




--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Modify-SQL-Script-during-WIX-Installation-process-tp7596198.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to