SQL Server Database Browse (ISqlDatabaseBrowse)Copy link to this sectionLink to this section copied!

OverviewCopy link to this sectionLink to this section copied!

The SQL Server Database Browse operation discovers databases on a specified server/instance and populates Windows Installer properties (and optional UI controls) with the results. Use it to let users pick a database at install time, then pass the selected value to your connection/query logic.

This object is created under SqlDatabasesComponent and appears in the SQL Operations tab in Advanced Installer.

OverviewCopy link to this sectionLink to this section copied!

Isqldatabasescomponent browse db

Methods

  • (No methods available for ISqlDatabaseBrowse)

Properties

  • Name (string) {get}{set} Gets or sets the display name of this browse operation.
  • ServerHostName (string) {get}{set} Gets or sets the target SQL Server host/instance to browse (e.g., localhost or SERVER\SQLEXPRESS).
  • UseTrustedConnection (bool) {get}{set} When true, uses Windows Authentication; when false, uses Username/PasswordProperty.
  • Username (string) {get}{set} Gets or sets the SQL login to use when UseTrustedConnection is false.
  • PasswordProperty (string) {get}{set} Gets or sets the installer property name that supplies the password at runtime (safer than hard-coding a password).
  • OdbcDriver (string) {get}{set} Gets or sets the ODBC driver name used for the browse operation (e.g., ODBC Driver 17 for SQL Server).
  • HideSystemDatabases (bool) {get}{set} When true, hides system databases (e.g., master, model, msdb, tempdb) from the results.
  • LoginTimeout (uint) {get}{set} Gets or sets the login timeout in seconds used when connecting to the server to enumerate databases.
  • IsVerbose (bool) {get}{set} Enables verbose logging for this browse operation when true.
  • ResultPropertyName (string) {get}{set} Gets or sets the installer property that will receive the selected database name.
  • ComboBoxControlPropertyName (string) {get}{set} Binds the browse results to the specified MSI ComboBox control property (for UI population).
  • ListControlPropertyName (string) {get}{set} Binds the browse results to the specified MSI List control property (alternative to ComboBox).
  • Object (uint) {get} Read-only internal identifier for this browse operation instance.

Sample commands

# SQL Operations - Database Browse

$advinst  = New-Object -ComObject "AdvancedInstaller"
$project  = $advinst.CreateProject($advinst.ProjectTypes.Enterprise)

# Create a Database Browse operation
$browseDb = $project.SqlDatabasesComponent.NewBrowseDatabase("Browse Database Connection")

# Configure server and credentials
$browseDb.ServerHostName       = "localhost"
$browseDb.UseTrustedConnection = $true
# Alternative (SQL login):
# $browseDb.UseTrustedConnection = $false
# $browseDb.Username = "dbuser"
# $browseDb.PasswordProperty = "DB_PASSWORD"

# Driver and behavior
$browseDb.OdbcDriver        = "ODBC Driver 17 for SQL Server"
$browseDb.HideSystemDatabases = $true
$browseDb.LoginTimeout        = 30
$browseDb.IsVerbose           = $true

# Bind results to MSI properties / UI controls
$browseDb.ResultPropertyName          = "SELECTED_DB"
$browseDb.ComboBoxControlPropertyName = "DB_COMBOBOX"
# or use a list control:
# $browseDb.ListControlPropertyName   = "DB_LIST"

$project.SaveAs("F:\cmdlet\output\Database Browse.aip")