List of available database providers

I have some problems with connection strings. I used to generate "Provider = SQLOLEDB" or "Provider = SQLNCLI". Now I see that some users have SQLNCLI10, while SQLNCLI is missing. Can I list the available providers so that I can choose the valid one?

System.Data.Common.DbProviderFactories.GetFactoryClasses () lists the .NET data providers, but I still don't know which connection string parameters are valid.

+4
source share
2 answers

If you use System.Data.SqlClient.SqlConnection (directly or indirectly), there is no need to specify the Provider element in the connection string. I assume that this value is simply ignored, if provided.

See the documentation for a complete list of all supported items in the SqlConnection connection strings.

However, if you use OleDb, this does what you want: http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbenumerator.aspx

For instance:

 internal static class Program { private static void Main(string[] args) { using (OleDbDataReader dataReader = OleDbEnumerator.GetRootEnumerator()) { while (dataReader.Read()) { Console.WriteLine("{0}, {1}", dataReader[0], dataReader[2]); } } } } 
+5
source

For more information about the connection string, see connectionstrings.com .

-1
source

All Articles