How to check if an OLEDB driver is installed on the system?

前端 未结 6 1977
走了就别回头了
走了就别回头了 2020-12-06 16:59

How can I make sure that a certain OLEDB driver is installed when I start my application? I use ADO from Delphi and would like to display a descriptive error message if the

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-06 17:17

    This is an old question but I had the same problem now and maybe this can help others.

    In Delphi 7 there is an procedure in ADODB that return a TStringList with the provider names.

    Usage example:

    names := TStringList.Create;
    ADODB.GetProviderNames(names);
    
    if names.IndexOf('SQLNCLI10')<>-1 then
      st := 'Provider=SQLNCLI10;'
    else if names.IndexOf('SQLNCLI')<>-1 then
      st := 'Provider=SQLNCLI;'
    else if names.IndexOf('SQLOLEDB')<>-1 then
      st := 'Provider=SQLOLEDB;';
    

提交回复
热议问题