SQL Operations (Browse & Test)Copy link to this sectionLink to this section copied!

OverviewCopy link to this sectionLink to this section copied!

The SQL Operations area groups the runtime operations that help you discover servers/databases and verify connectivity:

  • SQL Server Database Browse – browse databases on a selected server.
  • SQL Server Browse – browse/resolve available SQL servers/instances.
  • SQL Test Connection – validate a connection string/credentials before running scripts or queries.

These objects are created under the SqlDatabasesComponent and appear in the SQL Operations tab in Advanced Installer.

Sql operations

MethodsCopy link to this sectionLink to this section copied!

  • NewBrowseDatabase (string name) → ISqlDatabaseBrowse Creates a new database browse operation with the specified display name.
  • NewBrowseServer (string name) → ISqlServerBrowse Creates a new server browse operation with the specified display name.
  • NewTestConnection (string name) → ISqlTestConnection Creates a new test connection operation with the specified display name.
  • DeleteDatabaseObject (Variant item) Deletes an operation object created by this component. Pass the actual object instance returned by the collections below.

PropertiesCopy link to this sectionLink to this section copied!

  • BrowseDatabaseOperations (SAFEARRAY(Variant)) {get} Returns an array of ISqlDatabaseBrowse objects.
  • BrowseServerOperations (SAFEARRAY(Variant)) {get} Returns an array of ISqlServerBrowse objects.
  • TestConnectionOperations (SAFEARRAY(Variant)) {get} Returns an array of ISqlTestConnection objects.
  • ImpersonateUser (bool) {get}{set} When true, browse and test operations run under an impersonated user context.

Sample commandsCopy link to this sectionLink to this section copied!

# SQL Operations (Database Browse, Server Browse, Test Connection)

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

# Optional: run SQL operations under an impersonated context
$project.SqlDatabasesComponent.ImpersonateUser = $true

# Create operations
$dbBrowse  = $project.SqlDatabasesComponent.NewBrowseDatabase("Browse Database Connection")
$svrBrowse = $project.SqlDatabasesComponent.NewBrowseServer("Browse Server Connection")
$testConn  = $project.SqlDatabasesComponent.NewTestConnection("Test Connection 1")

# Inspect collections
$project.SqlDatabasesComponent.BrowseDatabaseOperations
$project.SqlDatabasesComponent.BrowseServerOperations
$project.SqlDatabasesComponent.TestConnectionOperations

# Delete an operation (pass the object, not the name)
# $project.SqlDatabasesComponent.DeleteDatabaseObject($testConn)

$project.SaveAs("F:\cmdlet\output\SQL Operations.aip")

Topics