'late binding' to load an ADO driver

  • Thread starter Thread starter Jonathan Sion
  • Start date Start date
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!
 
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! |
********************************************
 
Back
Top