Hi,
I have created a custom dialog UI, which contains two combobox with SQL server instance & on selection of one of SQLServer instance, another combobox has to be filled with name of Databases on that server instance.
I am able to find filling combo with SQL server Instances
I had written a similar CustomAction to fill the combobox with database names
[CustomAction]
public static ActionResult FillDatabases(Session xiSession)
{
xiSession.Log("Begin CustomAction");
xiSession.Log("Opening view");
View lView = xiSession.Database.OpenView("DELETE FROM ComboBox WHERE ComboBox.Property='DBNAME'");
lView.Execute();
lView = xiSession.Database.OpenView("SELECT * FROM ComboBox");
lView.Execute();
int Index = 1;
//bool flag = false;
try
{
Microsoft.SqlServer.Management.Smo.Server svr = new Microsoft.SqlServer.Management.Smo.Server(xiSession["DBSRVR"]);
foreach (Microsoft.SqlServer.Management.Smo.Database db in svr.Databases )
{
String dbName = db.Name;
Record lRecord = xiSession.Database.CreateRecord(3);
xiSession.Log("Setting record details");
lRecord.SetString(1, "DBNAME");
lRecord.SetInteger(2, Index);
lRecord.SetString(3, db.Name);
xiSession.Log("Adding record");
lView.Modify(ViewModifyMode.InsertTemporary, lRecord);
++Index;
}
}
catch (Exception ex)
{
//logException(xiSession, ex);
xiSession.Log(ex.Message );
}
lView.Close();
xiSession.Log("Closing view");
lView.Close();
return ActionResult.Success;
}
I want to call these custom actions somewhat like shown below,
<Binary Id="CustomActions.CA.dll" SourceFile="CustomActions.CA.dll" />
<CustomAction Id="FillServerInstances"
BinaryKey="CustomActions.CA.dll"
DllEntry="FillServerInstances"
Execute="immediate" Return="check" />
<CustomAction Id="FillDatabases"
BinaryKey="CustomActions.CA.dll"
DllEntry="FillDatabases"
Execute="immediate" Return="check" />
<InstallUISequence>
<Custom Action="FillServerInstances" After="CostFinalize" />
<Custom Action="FillDatabases" After="FillServerInstances" />
</InstallUISequence>
I need to show this Sqlserver selection custom dialog from another custom UI, in case user clicked on a pushbutton.
Am I doing the right thing in the WiX code?
Is there a better way in which combobox custom action fire only when user click on a pushbutton?
"FillDatabases" custom action have to be fire whenever user select a new SQLServer instance. How do i do that?
Thanks