'late binding' to load an ADO driver

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jonathan Sion

    'late binding' to load an ADO driver

    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!
  • Cowboy \(Gregory A. Beamer\)

    #2
    Re: 'late binding' to load an ADO driver

    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


    or just read it:


    *************** *************** **************
    | Think outside the box! |
    *************** *************** **************
    "Jonathan Sion" <yoni@nobhillso ft.comwrote in message
    news:8383ffc7-16ec-4e36-9b7f-c619d146baea@s5 0g2000hsb.googl egroups.com...
    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!

    Comment

    Working...