DbProviderFactory & creating from DbProviderFactories.GetFactoryCl

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi;

When I call
DbProviderFactories.GetFactory("System.Data.SqlClient").CreateDataSourceEnumerator().GetDataSources();

I get 2 entries for my computer (Sql Server & Sql Server Express). For Sql
Server I get "BELLE", DBNull, "No", "8.00.194" and for Sql Server Express I
get "BELLE", "SQLEXPRESS", "No", "9.00.1399.06".

My question is, how do I build a connection string to the server based on
this info returned?
 
Hi Dave,

The first string is the server name, the second string is the instance
name. If the second one is DBNull, it means that the instance is the
default one on that server. So, for the first entry, you can use BELLE as
the datasource in the connection string. And for the second one, you can
use BELLE\SQLEXPRESS as the datasource. HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
You're welcome.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top