'late binding' to load an ADO driver

J

Jonathan Sion

Hi All,
this is a bit tricky: i am writing an application that uses ADO.NET.
the trick is: i dont know in advance what driver it would be. i want
to let user point to a DLL (which has to be an ADO.NET driver) and in
'late binding' (to use activeX terms... yes i am that old) load it and
then use objects it exposes (connection, DataAdapter, etc...)

can this be done? anybody know of any code snippet that could get me
started?

thanks!
 
C

Cowboy \(Gregory A. Beamer\)

1. Can this be solved by the connection string or do you hve to alter the
SQL? If you are using OLEDB, you should be able to just alter the connection
string. If you are trying to optimize, examine question 2.

2. Is this truly random, or are you working from a known set of drivers?
This will determine whether or not you can use a factory pattern over
multiple drivers.

With #1, you might just have the configuration file feed the proper
connection string, which can include a provider type. If you want a bit more
efficiency, add a factory method (#2) and optimize the transport (SqlClient
for SQL Server, etc.). ALl of this can be accomplished with the enterprise
library (download from MS downloads) rather easily, as the factory is
already in place. Just a few config changes and a bit of a learning curve.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

********************************************
| Think outside the box! |
********************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top