//取SQLSERVER的版本
function getSQLVersion(ServerName,LoginName,LoginPassword:String):TSqlVersion;
var
osqlserver :_SqlServer;
temp :SQLDMO_SQL_VER;
begin
try
oSqlserver :=coSqlserver.Create;
oSqlserver._AddRef;
oSqlserver.Name :=ServerName;
temp :=oSqlserver.PingSQLServerVersion(ServerName,LoginName,LoginPassword);
if temp=SQLDMOSQLVer_Unknown then
result :=UnknownVer
else if temp=SQLDMOSQLVer_Pre_60 then
result :=SQL60
else if temp=SQLDMOSQLVer_60 then
result :=SQL60
else if temp=SQLDMOSQLVer_65 then
result :=SQL65
else if temp=SQLDMOSQLVer_70 then
result :=SQL70
else
result :=SQL2000;
oSqlserver._Release;
oSqlserver :=nil;
except
on E :Exception do
begin
application.MessageBox(Pchar(‘取SQLSERVER版本資訊出錯:‘+E.message),‘系統提示‘,MB_OK+MB_ICONSTOP);
end;
end;
end;
//取安裝SQLSERVER操作系統的版本
function getOSType(ServerName:String):ToSTypes;
var
oSqlserver :_SqlServer;
begin
try
oSqlServer :=coSqlServer.Create;
oSqlserver._AddRef;
oSqlserver.Name :=ServerName;
if oSqlserver.IsOS(SQLDMO_WIN95) then
result :=Win98ORWin95
else if oSqlserver.IsOS