Programmer Question
I might be connected to either Oracle, Sybase, or MSFT SQL Server databases.
How can I detect which vendor I am connected to at run-time if an instance of System.Data.Odbc.OdbcConnection
is passed to my method? Here is a set-up:
enum VendorType
{
Unknown = 0, // Bill Wagner recommends an Unknown enum.
Microsoft,
Oracle,
Sybase
}
public static VendorType GetConnectionVendorType()
{
if (Connection == null)
{
return VendorType.Unknown;
}
if (...)
{
return VendorType.Microsft;
}
if (...)
{
return VendorType.Oracle;
}
if (...)
{
return VendorType.Oracle;
}
// Just in case we got here.
return VendorType.Unknown;
}
Thanks!
Find the answer here
No comments:
Post a Comment