//检测SqlServer是否正确安装
function ScanSqlServer(SqlEdition)
NUMBER BackValue;
begin
//初始化变量
BackValue = 0;
if RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0 then
BackValue=-1;
endif;
switch(SqlEdition)
case "sql2000server":
if RegDBKeyExist("Software\\Microsoft\\Microsoft SQL Server\\80\\Tools\\ClientSetup")<0 then
BackValue=-1;
endif;
case "sql2000desktop":
if RegDBKeyExist("Software\\Microsoft\\Microsoft SQL Server\\80\\Tools\\ClientSetup")<0 then
BackValue=-1;
endif;
case "sql2000msde":
if RegDBKeyExist("Software\\Microsoft\\MSSQLServer\\Setup")<0 then
BackValue=-1;
endif;
endswitch;
return BackValue;
end;
//获得SqlServer的DATA路径
function GetSqlData(DataPath)
STRING REGKey,SqlDataPath;
NUMBER nvType,SQLPathTmpSize;
begin
if RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)>=0 then
if RegDBKeyExist("SOFTWARE\\Microsoft\\MSSQLServer\\Setup")>=0 then
REGKey="SOFTWARE\\Microsoft\\MSSQLServer\\Setup";
nvType=REGDB_STRING;
RegDBGetKeyValueEx(REGKey,"SQLDataRoot",nvType,SqlDataPath,SQLPathTmpSize);
endif;
else
return -1;
endif;
DataPath=SqlDataPath^"Data";
return 0;
end;
//获得SqlServer的路径
function GetSqlPath(SqlPathTmp)
STRING REGKey,SQLPathTmp;
NUMBER nvType,SQLPathTmpSize;
begin
if RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE)<0 then
return -1;
endif;
if RegDBKeyExist("Software\\Microsoft\\Microsoft SQL Server\\80\\Tools\\ClientSetup")<0 then
return -10;
endif;
REGKey="Software\\Microsoft\\Microsoft SQL Server\\80\\Tools\\ClientSetup";
nvType=REGDB_STRING;
if (RegDBGetKeyValueEx(REGKey,"SQLPath",nvType,SQLPathTmp,SQLPathTmpSize)<0) then
return -1;
endif;
SqlPathTmp=SQLPathTmp;
return 0;
end;