Not
Bu sayfaya erişim yetkilendirme gerektiriyor. Oturum açmayı veya dizinleri değiştirmeyi deneyebilirsiniz.
Bu sayfaya erişim yetkilendirme gerektiriyor. Dizinleri değiştirmeyi deneyebilirsiniz.
Applies to:SQL Server
Belirtilen SQL Server Express LocalDB örneği için var olup olmadığı, kullandığı LocalDB sürümü, çalışıp çalışmadığı gibi bilgileri döndürür.
Bilgiler, aşağıdaki tanıma sahip adlandırılmış LocalDBInstanceInfobir struct içinde döndürülür.
typedef struct _LocalDBInstanceInfo
{
// Contains the size of the LocalDBInstanceInfo struct
DWORD cbLocalDBInstanceInfoSize;
// Holds the instance name
TLocalDBInstanceNamewszInstanceName;
// TRUE if the instance files exist on disk, FALSE otherwise
BOOL bExists;
// TRUE if the instance configuration registry is corrupted, FALSE otherwise
BOOLbConfigurationCorrupted;
// TRUE if the instance is running at the moment, FALSE otherwise
BOOL bIsRunning;
// Holds the LocalDB version for the instance in the format: major.minor.build.revision
DWORD dwMajor;
DWORD dwMinor;
DWORD dwBuild;
DWORD dwRevision;
// Holds the date and time when the instance was started for the last time
FILETIME ftLastStartUTC;
// Holds the name of the TDS named pipe to connect to the instance
WCHARwszConnection;
// TRUE if the instance is shared, FALSE otherwise
BOOLbIsShared;
// Holds the shared name for the instance (if the instance is shared)
TLocalDBInstanceNamewszSharedInstanceName;
// Holds the SID of the instance owner (if the instance is shared)
WCHARwszOwnerSID;
// TRUE if the instance is Automatic, FALSE otherwise
BOOLbIsAutomatic;
} LocalDBInstanceInfo;
Header file:msoledbsql.h
Syntax
HRESULT LocalDBGetInstanceInfo(
PCWSTR wszInstanceName ,
PLocalDBInstanceInfo pInstanceInfo ,
DWORD dwInstanceInfoSize
);
Arguments
wszInstanceName
[Giriş] Örnek adı.
pInstanceInfo
[Çıkış] LocalDB örneği hakkındaki bilgileri depolamak için arabellek.
dwInstanceInfoSize
[Input] Holds the size of the InstanceInfo 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_INVALID_INSTANCE_NAME | Belirtilen örnek adı geçersiz. |
| LOCALDB_ERROR_UNKNOWN_INSTANCE | Örnek yok. |
| LOCALDB_ERROR_INSTANCE_FOLDER_PATH_TOO_LONG | Örneğin depolanması gereken yol değerinden uzundur MAX_PATH. |
| LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_FOLDER | Örnek klasörüne erişilemiyor. |
| LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_REGISTRY | Örnek kayıt defterine erişilemiyor. |
| LOCALDB_ERROR_INSTANCE_CONFIGURATION_CORRUPT | Örnek yapılandırması bozuk. |
| 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 (lpInstanceInfoSize) is to enable the API to return different versions of the LocalDBInstanceInfostruct, effectively enabling forward and backward compatibility.
If the struct size argument (lpInstanceInfoSize) matches the size of a known version of the LocalDBInstanceInfostruct, 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 LocalDBGetInstanceInfo şöyle görünür:
LocalDBInstanceInfo ii;
LocalDBInstanceInfo(L"Test", &ii, sizeof(LocalDBInstanceInfo));
LocalDB API'sini kullanan bir kod örneği için bkz. SQL Server Express LocalDB başvurusu.