--- title: "LocalDBGetVersionInfo Function | Microsoft Docs" ms.custom: "" ms.date: "03/03/2017" ms.prod: sql ms.prod_service: "database-engine" ms.reviewer: "" ms.technology: ms.topic: "reference" apiname: - "LocalDBGetVersionInfo" apilocation: - "sqluserinstance.dll" apitype: "DLLExport" ms.assetid: d4aaea30-1d0d-4436-bcdc-5c101d27b1c1 author: "CarlRabeler" ms.author: "carlrab" --- # LocalDBGetVersionInfo Function [!INCLUDE[appliesto-ss-xxxx-xxxx-xxx-md](../../includes/appliesto-ss-xxxx-xxxx-xxx-md.md)] Returns information for the specified SQL Server Express LocalDB version, such as whether it exists and the full LocalDB version number (including build and release numbers). The information is returned in the form of a **struct** named **LocalDBVersionInfo**, which has the following definition. ``` typedef struct _LocalDBVersionInfo { // Contains the size of the LocalDBVersionInfo struct DWORD cbLocalDBVersionInfoSize; // Holds the version name TLocalDBVersionwszVersion; // TRUE if the instance files exist on disk, FALSE otherwise BOOL bExists; // Holds the LocalDB version for the instance in the format: major.minor.build.revision DWORD dwMajor; DWORD dwMinor; DWORD dwBuild; DWORD dwRevision; } LocalDBVersionInfo; ``` **Header file:** sqlncli.h ## Syntax ``` HRESULT LocalDBGetVersionInfo( PCWSTR wszVersionName, PLocalDBVersionInfo pVersionInfo, DWORD dwVersionInfoSize); ``` ## Parameters *wszVersionName* [Input] The LocalDB version name. *pVersionInfo* [Output] The buffer to store the information about the LocalDB version. *dwVersionInfoSize* [Input] Holds the size of the *VersionInfo* buffer. ## Returns S_OK The function succeeded. [LOCALDB_ERROR_NOT_INSTALLED](../../relational-databases/express-localdb-error-messages/localdb-error-not-installed.md) SQL Server Express LocalDB is not installed on the computer. [LOCALDB_ERROR_INVALID_PARAMETER](../../relational-databases/express-localdb-error-messages/localdb-error-invalid-parameter.md) One or more specified input parameters are invalid. [LOCALDB_ERROR_UNKNOWN_VERSION](../../relational-databases/express-localdb-error-messages/localdb-error-unknown-version.md) The specified LocalDB version does not exist. [LOCALDB_ERROR_INTERNAL_ERROR](../../relational-databases/express-localdb-error-messages/localdb-error-internal-error.md) An unexpected error occurred. See the event log for details. ## Details The rationale behind the introduction of the **struct** size argument (*lpVersionInfoSize*) is to enable the API to return different versions of the **LocalDBVersionInfostruct**, effectively enabling forward and backward compatibility. If the **struct** size argument (*lpVersionInfoSize*) matches the size of a known version of the **LocalDBVersionInfostruct**, that version of the **struct** is returned. Otherwise, LOCALDB_ERROR_INVALID_PARAMETER is returned. A typical example of **LocalDBGetVersionInfo** API usage looks like this: ``` LocalDBVersionInfo vi; LocalDBVersionInfo(L"11.0", &vi, sizeof(LocalDBVersionInfo)); ``` ## Remarks For a code sample that uses LocalDB API, see [SQL Server Express LocalDB Reference](../../relational-databases/sql-server-express-localdb-reference.md). ## See Also [SQL Server Express LocalDB Header and Version Information](../../relational-databases/express-localdb-instance-apis/sql-server-express-localdb-header-and-version-information.md)