Functions

src/CustomActions/DataSource/SqlDMO.h File Reference

Go to the source code of this file.

Functions

CA_API UINT __stdcall SQLDMO_ListAvailableSQLServers (MSIHANDLE hInstall)
 Enumerate available SQL servers using Data Management Objects (DMO).

Function Documentation

CA_API UINT __stdcall SQLDMO_ListAvailableSQLServers ( MSIHANDLE  hInstall)

Enumerate available SQL servers using Data Management Objects (DMO).

Parameters:
SQLDMO_LIST_TYPEList type to populate with data.
SQLDMO_LIST_PROPERTYThe property associated with the list.
SQLDMO_LIST_INDEXOptional index to start adding items at, default is 2 (assumes one item in the list already).
SQLDMO_LIST_LOCALOptional name to skip, eg. useful for local servers with "(local)".

This function populates an MSI list attached to a property SQLDMO_LIST_PROPERTY and of type SQLDMO_LIST_TYPE, beginning with index SQLDMO_LIST_INDEX (default is 2, assuming there's one item). It executes SELECT * FROM [SQLDMO_LIST_TYPE] WHERE Property=[SQLDMO_LIST_PROPERTY] to locate the target.

See http://support.microsoft.com/kb/287737 for details about retreiving SQL servers with DMO.

This custom action can be used in combination with a combo box. Call the CA in the InstallUISequence.

<CustomAction Id="SetSqlDmoListLocal" Property="SQLDMO_LIST_LOCAL" Value="(local)" Execute="immediate" />
<CustomAction Id="SetSqlDmoListIndex" Property="SQLDMO_LIST_INDEX" Value="2" Execute="immediate" />
<CustomAction Id="SetSqlDmoListProperty" Property="SQLDMO_LIST_PROPERTY" Value="DATABASE_SERVER" Execute="immediate" />
<CustomAction Id="SetSqlDmoListType" Property="SQLDMO_LIST_TYPE" Value="ComboBox" Execute="immediate" />
<InstallUISequence>
  <Custom Action="SetSqlDmoListProperty" After="CostInitialize" />
  <Custom Action="SetSqlDmoListType" After="SetSqlDmoListProperty" />
  <Custom Action="SetSqlDmoListIndex" After="SetSqlDmoListType" />
  <Custom Action="SetSqlDmoListLocal" After="SetSqlDmoListIndex" />
  <Custom Action="SQLDMO_ListAvailableSQLServers" After="SetSqlDmoListType">NOT Installed</Custom>
</InstallUISequence>

Use a ComboBox control in the UI.

<Control Id="Server" Type="ComboBox" X="30" Y="65" Width="200" Height="18" Property="DATABASE_SERVER">
  <ComboBox Property="DATABASE_SERVER">
    <ListItem Text="(local)" Value="(local)" />
  </ComboBox>
</Control>


© Application Security Inc. - All Rights Reserved http://msiext.codeplex.com