列举系统安装的所有可用的数据库提供程序
时间:2011-03-06 来源:许明会
using System;
using System.Data;
using System.Data.Common;
namespace ConsoleWin
{
public class CmdWin
{
public static void Main()
{
Console.WriteLine("Hello,This is a Console Line Applicaiton!");
DataTable factoryClassesTable = DbProviderFactories.GetFactoryClasses();
foreach (DataRow factoryClass in factoryClassesTable.Rows)
{
Console.WriteLine("Name:\t\t" + factoryClass["Name"]);
Console.WriteLine("Description:\t" + factoryClass["Description"]);
Console.WriteLine("Invariant Name:\t" + factoryClass["invariantName"]);
Console.WriteLine("\n");
}
Console.ReadKey();
}
}
}
/*
Hello,This is a Console Line Applicaiton!
Name: Odbc Data Provider
Description: .Net Framework Data Provider for Odbc
Invariant Name: System.Data.Odbc
Name: OleDb Data Provider
Description: .Net Framework Data Provider for OleDb
Invariant Name: System.Data.OleDb
Name: OracleClient Data Provider
Description: .Net Framework Data Provider for Oracle
Invariant Name: System.Data.OracleClient
Name: SqlClient Data Provider
Description: .Net Framework Data Provider for SqlServer
Invariant Name: System.Data.SqlClient
Name: Microsoft SQL Server Compact Data Provider
Description: .NET Framework Data Provider for Microsoft SQL Server Compact
Invariant Name: System.Data.SqlServerCe.3.5
Name: SQLite Data Provider
Description: .Net Framework Data Provider for SQLite
Invariant Name: System.Data.SQLite
Name: MySQL Data Provider
Description: .Net Framework Data Provider for MySQL
Invariant Name: MySql.Data.MySqlClient
*/
相关阅读 更多 +