Aracılığıyla paylaş


LocalDBGetVersionInfo function

Applies to:SQL Server

Belirtilen SQL Server Express LocalDB sürümü için var olup olmadığı ve tam LocalDB sürüm numarası (derleme ve sürüm numaraları dahil) gibi bilgileri döndürür.

Bilgiler, aşağıdaki tanıma sahip adlandırılmış LocalDBVersionInfobiçiminde struct döndürülür.

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

[Giriş] LocalDB sürüm adı.

pVersionInfo

[Çıkış] LocalDB sürümüyle ilgili bilgileri depolamak için arabellek.

dwVersionInfoSize

[Input] Holds the size of the VersionInfo buffer.

Returns

S_OK: İşlev başarılı oldu.

Error Description
LOCALDB_ERROR_NOT_INSTALLED SQL Server Express LocalDB bilgisayarda yüklü değil.
LOCALDB_ERROR_INVALID_PARAMETER Belirtilen bir veya daha fazla giriş parametresi geçersiz.
LOCALDB_ERROR_UNKNOWN_VERSION Belirtilen LocalDB sürümü yok.
LOCALDB_ERROR_INTERNAL_ERROR Beklenmeyen bir hata oluştu. Ayrıntılar için olay günlüğüne bakın.

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. Aksi takdirde, LOCALDB_ERROR_INVALID_PARAMETER döndürülür.

TIPIK bir API kullanımı örneği LocalDBGetVersionInfo şöyle görünür:

LocalDBVersionInfo vi;
LocalDBVersionInfo(L"11.0", &vi, sizeof(LocalDBVersionInfo));

Remarks

LocalDB API'sini kullanan bir kod örneği için bkz. SQL Server Express LocalDB başvurusu.