Get the database type

Topics: Data Access Application Block
Aug 24, 2007 at 8:03 AM

I'm new to Csharp and Entlib 3.1

Is there a way to get the database type (Oracle, MS SQL server, ..) with the Database object?
Database myDb1 = DatabaseFactory.CreateDatabase("Db1");
Database myDb2 = DatabaseFactory.CreateDatabase("Db2");

Thanks in advance
Aug 24, 2007 at 3:58 PM

You can always query on the type of the Database object, e.g. myDb1 is SqlDatabase. Keep in mind though that this will only tell you the kind of database client being used; you can always connect to a SQL Server database using ODBC and in this case they query type would return false.

Hope this helps,