Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

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

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 driver is missing. The error that's returned from ADO isn't always that user-friendly.

There are probably a nice little function that returns all installed drivers but I haven't found it.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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;';

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...