Remarque
L’accès à cette page nécessite une autorisation. Vous pouvez essayer de vous connecter ou de modifier des répertoires.
L’accès à cette page nécessite une autorisation. Vous pouvez essayer de modifier des répertoires.
Applies to:SQL Server
Retourne des informations pour la version spécifiée de SQL Server Express LocalDB, notamment si elle existe, ainsi que le numéro de version complet de LocalDB (avec les numéros de build et de version).
Les informations sont retournées sous la forme d’un struct nom LocalDBVersionInfo, qui a la définition suivante.
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:msoledbsql.h
Syntax
HRESULT LocalDBGetVersionInfo(
PCWSTR wszVersionName ,
PLocalDBVersionInfo pVersionInfo ,
DWORD dwVersionInfoSize);
Arguments
wszVersionName
[Entrée] Le nom de version de LocalDB.
pVersionInfo
[Sortie] La mémoire tampon pour stocker des informations sur la version de LocalDB.
dwVersionInfoSize
[Input] Holds the size of the VersionInfo buffer.
Returns
S_OK: la fonction a réussi.
| Error | Description |
|---|---|
| LOCALDB_ERROR_NOT_INSTALLED | SQL Server Express LocalDB n’est pas installé sur l’ordinateur. |
| LOCALDB_ERROR_INVALID_PARAMETER | Un ou plusieurs paramètres d'entrée spécifiés ne sont pas valides. |
| LOCALDB_ERROR_UNKNOWN_VERSION | La version localDB spécifiée n’existe pas. |
| LOCALDB_ERROR_INTERNAL_ERROR | Une erreur inattendue s’est produite. Pour plus d'informations, consultez le journal des événements. |
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. Sinon, LOCALDB_ERROR_INVALID_PARAMETER est retournée.
Un exemple classique d’utilisation de l’API LocalDBGetVersionInfo ressemble à ceci :
LocalDBVersionInfo vi;
LocalDBVersionInfo(L"11.0", &vi, sizeof(LocalDBVersionInfo));
Remarks
Pour obtenir un exemple de code qui utilise l’API LocalDB, consultez la référence SQL Server Express LocalDB.