Comment obtenir le chemin d'installation de Sqlserver par programme.Comment obtenir le chemin d'installation SQLSERVER en utilisant C++?
Si nous optons pour le Registre Puis Registre Hives peut être différent d'un OS à d'autres OS
Comme w2k3 à w3k8 et VISTA et W2k8 R2 comme ça ..
Mais je ne l'aide du Registre comme suit mais j'ai donné un code dur vAleurs clés Si Hives sont identiques alors pas de problème si différent Le problème augmente ....
CRegKey cregkey;
DWORD result;
const char subkey[]="SOFTWARE\\Microsoft\\Microsoft SQL Server\\100";
const char keyval[] = "VerSpecificRootDir";
char path[ 2048 ];
result = cregkey.Open(HKEY_LOCAL_MACHINE,subkey);
if (ERROR_SUCCESS == result)
{
DWORD dwCount = sizeof(path);
result = cregkey.QueryStringValue(keyval, path, &dwCount);
if (ERROR_SUCCESS == result)
{
cout<<" The SQLSERVER Pathis "<<path<<endl;
}
}