Re: How to detect SQLServer 2005 ?



GuangXiN wrote:
I miss some code

public static bool ExistSqlServerService() {
bool flag = false;
ServiceController[] services = ServiceController.GetServices();
for(int i = 0; i < services.Length; i++) {
if(services[i].DisplayName.ToString().Equals("MSSQLSERVER") {
flag = true;
break;
}
}
return flag;
}

The service can have different names.

Arne
.