Catatan
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba masuk atau mengubah direktori.
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba mengubah direktori.
Applies to:SQL Server
Mengembalikan informasi untuk versi SQL Server Express LocalDB yang ditentukan, seperti apakah ada dan nomor versi LocalDB lengkap (termasuk nomor build dan rilis).
Informasi dikembalikan dalam bentuk struct bernama LocalDBVersionInfo, yang memiliki definisi berikut.
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
[Input] Nama versi LocalDB.
pVersionInfo
[Output] Buffer untuk menyimpan informasi tentang versi LocalDB.
dwVersionInfoSize
[Input] Holds the size of the VersionInfo buffer.
Returns
S_OK: Fungsi berhasil.
| Error | Description |
|---|---|
| LOCALDB_ERROR_NOT_INSTALLED | SQL Server Express LocalDB tidak diinstal di komputer. |
| LOCALDB_ERROR_INVALID_PARAMETER | Satu atau beberapa parameter input yang ditentukan tidak valid. |
| LOCALDB_ERROR_UNKNOWN_VERSION | Versi LocalDB yang ditentukan tidak ada. |
| LOCALDB_ERROR_INTERNAL_ERROR | Terjadi kesalahan tidak terduga. Lihat log peristiwa untuk detailnya. |
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. Jika tidak, LOCALDB_ERROR_INVALID_PARAMETER dikembalikan.
Contoh LocalDBGetVersionInfo umum penggunaan API terlihat seperti ini:
LocalDBVersionInfo vi;
LocalDBVersionInfo(L"11.0", &vi, sizeof(LocalDBVersionInfo));
Remarks
Untuk sampel kode yang menggunakan API LocalDB, lihat referensi SQL Server Express LocalDB.