Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find out if a particular OleDb provider is installed
Message
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01167807
Message ID:
01168025
Views:
15
>>Is there a way to find out if a particular OleDb provider is installed at runtime?
>>Thanks,
>>Einar
>
>Ohh beautiful is the .NET framework!!!
>
>
>System.Data.OleDb.OleDbEnumerator o = new System.Data.OleDb.OleDbEnumerator();
>System.Data.DataTable dt = o.GetElements();
>
>string s = "";
>for (int i = 0; i < dt.Rows.Count; i++)
>{
>	for (int j = 0; j < dt.Columns.Count; j++)
>	{
>		s += dt.Rows[i][j].ToString() + " ";
>	}
>	s += Environment.NewLine;
>}
>MessageBox.Show(s);
>
>
>Now this might query the (f@#$%@$!@#ing) registry behind the scenes but ignorance is bliss :)

Dealing with the registry isn't really so bad thanks to the MS registry class.
? OdbcDriverExists("sql server")     && case doesn't matter

Function OdbcDriverExists(tcDriver)
  LOCAL lcSaveProc, oOdbcReg as OdbcReg
  LOCAL ARRAY aDriver[1]     && array to hold driver info if driver exists
  lcSaveProc = Set("Procedure")
  Set Procedure To (HOME(2) + "classes\registry.prg")

  ** odbc specific registry handling
  oOdbcReg = CREATEOBJECT("OdbcReg")

  ** does the requested driver exist?
  llRetVal = (oOdbcReg.EnumOdbcDrvrs(@aDriver, tcDriver) = 0)
  Set Procedure to &lcSaveProc

Return llRetVal
Previous
Reply
Map
View

Click here to load this message in the networking platform