Hello,
My problem is this:
In the phase of installation of my software, how I can know if SQL Server 2005 (anyone edition) is installed in the guest system?
Thank you.
You could scan LAN vid SqlDataSourceEnumerator.
using System.Data.Sql;class Program
{
static void Main()
{
// Retrieve the enumerator instance and then the data.
SqlDataSourceEnumerator instance =
SqlDataSourceEnumerator.Instance;
System.Data.DataTable table = instance.GetDataSources();
// Display the contents of the table.
DisplayData(table);
Console.WriteLine("Press any key to continue.");
Console.ReadKey();
}
private static void DisplayData(System.Data.DataTable table)
{
foreach (System.Data.DataRow row in table.Rows)
{
foreach (System.Data.DataColumn col in table.Columns)
{
Console.WriteLine("{0} = {1}", col.ColumnName, row[col]);
}
Console.WriteLine("============================");
}
}
}|||
Thank you Konstantin,
this code is very good and I will use for my application BUT my problem is to find (if exist) an anyone (express, enterprise, standard, etc) instance of SQL Server in the same machine where my application (or in the installation phase of application) is running.
however, thank you.
|||If you use Visual Studio for building installer, you could add "Windows Installer Search" at Launch Conditions page. But you need to know ComponentIDs for SQL Server.
I think, that this link would be helpful http://msdn2.microsoft.com/en-us/library/1s08hzfe(vs.80).aspx