LocalDBGetInstances Function

Returns all SQL Server Express LocalDB instances with the given version.

Header file: sqlncli.h

Syntax

#define MAX_LOCALDB_INSTANCE_NAME_LENGTH 128
typedef WCHAR TLocalDBInstanceName[MAX_LOCALDB_INSTANCE_NAME_LENGTH + 1];
typedef TLocalDBInstanceName* PTLocalDBInstanceName;

HRESULT LocalDBGetInstances(
           PTLocalDBInstanceName pInstanceNames,
           LPDWORD lpdwNumberOfInstances
);

Parameters

  • pInstanceNames
    [Output] When this function returns, contains the names of both named and default LocalDB instances on the user’s workstation.

  • lpdwNumberOfInstances
    [Input/Output] On input, contains the number of slots for instance names in the pInstanceNames buffer. On output, contains the number of LocalDB instances found on the user’s workstation.

Returns

Remarks

For a code sample that uses LocalDB API, see SQL Server Express LocalDB Reference.

See Also

Concepts

SQL Server Express LocalDB Header and Version Information