How to identify if sql server 2005 express is installed us开发者_开发技巧ing cmd
As a dirty hack, you can check whether sqlcmd command can be executed.
EDIT
yep, I was right.
To determine if you have MSDE or Microsoft SQL Server installed on your computer:
- On the taskbar at the bottom of your screen, click Start, and then click Search.
- In the Search dialog box, type sqlservr.exe
Click OK.
If this file is present on your system, then you have MSDE or SQL Server installed.
http://www.microsoft.com/security/updates/checkversion.aspx
It is not using a comman or sqlcmd but this will get you the version of the named server
using (var connection = new SqlConnection("Data Source=localhost;Integrated Security=true;initial catalog=master"))
{
connection.Open();
string version = connection.ServerVersion;
}
精彩评论