<Control Id="ComboBoxDbServerNames" Type="ComboBox" Width="262" Height="13" X="26" Y="98" Property="DATABASE_SERVERNAME" > <ComboBox Property="DATABASE_SERVERNAME"> <ListItem Value="(local)" /> </ComboBox> </Control>
public class CustomActions { [CustomAction] public static ActionResult CustomAction1(Session xiSession) { Microsoft.Deployment.WindowsInstaller.View lView = xiSession.Database.OpenView("DELETE FROM ComboBox WHERE ComboBox.Property='DATABASE_SERVERNAME'"); lView.Execute(); lView = xiSession.Database.OpenView("SELECT * FROM ComboBox"); lView.Execute(); //MessageBox.Show("lView Execute"); List<string> instances = RetrieveSQLInstances(); int Counter = 0; int Index = 0; bool flag = false; try { foreach (string str in instances) { Record lRecord = xiSession.Database.CreateRecord(4); lRecord.SetString(1, "DATABASE_SERVERNAME"); lRecord.SetInteger(2, Index); lRecord.SetString(3, str); lRecord.SetString(4, str); lView.Modify(ViewModifyMode.InsertTemporary, lRecord); Counter = Index; ++Index; } } catch (Exception ex) { ex.ToString(); } //MessageBox.Show(Convert.ToString(Counter)); //MessageBox.Show("Done"); lView.Close(); xiSession.Log("Closing view"); lView.Close(); return ActionResult.Success; } private static List<string> RetrieveSQLInstances() { List<string> result = new List<string>(); DataTable dbInstances = System.Data.Sql.SqlDataSourceEnumerator.Instance.GetDataSources(); foreach (DataRow dr in dbInstances.Rows) { StringBuilder sb = new StringBuilder(); sb.Append(dr["ServerName"].ToString()); if (dr["InstanceName"].ToString().Length > 0) { sb.Append("\\"); sb.Append(dr["InstanceName"].ToString()); } result.Add(sb.ToString()); } result.Sort(); //result.Insert(0, _ResourceManager.GetString("msgString262")); return result; } public static ActionResult SqlValidate(Session sqlSession) { sqlSession.Log("Begin CustomAction1"); MessageBox.Show("Calling SqlValidate"); if (sqlSession["DATABASE_SERVERUSERNAME"] == "" && sqlSession["DATABASE_SERVERPASSWORD"]=="") { MessageBox.Show("Windows Authentication"); } else { MessageBox.Show("Sql Server Authentication"); } return ActionResult.Success; } } -- View this message in context: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Combo-Box-Wix-Customization-tp687975p7595631.html Sent from the wix-users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users