views:

84

answers:

2

Hey !

I am making an application which is a user interface to access 2 types of databases - SQLite and SQL Server.

The thing is, SQLite doesnt need to be "installed" since its just a flatfile database, but on the other hand, SQL Server (Express/normal) need to be installed before use. My Question is simple:

Is there a way by which i can find out if an instance of SQL Server has been installed on the local machine by using a C# program?

+3  A: 

If your app is installed on the machine in question, you could inspect the registry using something similar to this:

using Microsoft.Win32; 
RegistryKey RK = Registry.CurrentUser.OpenSubKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Microsoft SQL Server");
    if(RK != null)
    {
       // It's there 
    }
    else
    {
       // It's not there 
    }
jbruton
A: 

BTW, have you considered SQL Server Compact ( Wikipedia )?

SQL Server Compact is a 'zero-install', 'single file' database like SQLite.

kervin
well .. This software that i am making is used to manage databases of SQLite and SQLserver types :) The database type that i am using to maintain the software's data is SQLite.
Skun