473,804 Members | 3,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

'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!
Jul 25 '08 #1
1 1155
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! |
*************** *************** **************
"Jonathan Sion" <yo**@nobhillso ft.comwrote in message
news:83******** *************** ***********@s50 g2000hsb.google groups.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!
Jul 26 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1461
by: ThunderMusic | last post by:
Hi, I have some code to load some plug-ins, but the code requires me to know the name of the class to load (here: SamplePlugin, derived from IPlugin) : (Here is some C# code, but I use VB.Net to code my program) using System; using System.Reflection; public class Driver {
9
10431
by: Zlatko Matiæ | last post by:
I was reading about late binding, but I'm not completely sure what is to be done in order to adjust code to late binding... For example, I'm not sure if this is correct: early binding: Dim ws As DAO.Workspace Dim db As DAO.Database Dim qdf As DAO.QueryDef Dim rs As DAO.Recordset
5
1556
by: Daniel Bass | last post by:
..Net is great for modulerising libraries, so that all you need do to access a DLL, is simply call Add Reference and wallah, it's as though the library were written in your project. But what happens when i know that a library must have some method, say void StoreXML ( string XMLmsg ) but want to late bind, as in, only at run time, decide which library i wish to use.
1
2848
by: Jim | last post by:
Hey all I'm trying to late bind a VB6 object in Component Services using c#. I've been able to do tons of late binding, but now that I have a com+ object that doesn't have a method exposed directly, I'm having tons of trouble. (lots of research, lots of newsgroups, but no success! I have an existing COM+ object "Company.Person" which has several interfaces. To load my object, I have to invoke a method that is "Imported" to "Person", the...
5
303
by: Pete | last post by:
Hi, I want to essentially perform late binding in c#. The rough equivalent in VB (6) would be: dim x as ifcMyInterface dim SensibleClassName as string SensibleClassName = .... 'something sensible
1
1552
by: tlwright1414 | last post by:
I have Assembly A which late binds Assembly B using the following code... Assembly b = Assembly.LoadFile(@"C:\dev\B.dll"); object o = b.CreateInstance( "NameSpaceB.ClassB" ); object oEmitObj = Activator.CreateInstance (o.GetType(),false); object args = new object{m_Arg1}; o.GetType().InvokeMember("Process", BindingFlags.InvokeMethod, null, oEmitObj, args);
0
674
by: ThunderMusic | last post by:
Hi, I have some code to load some plug-ins, but the code requires me to know the name of the class to load (here: SamplePlugin, derived from IPlugin) : using System; using System.Reflection; public class Driver { static void Main()
30
2840
by: lgbjr | last post by:
hi All, I've decided to use Options Strict ON in one of my apps and now I'm trying to fix a late binding issue. I have 5 integer arrays: dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) as integer The integers in these arrays are actually pointers to different columns of data in a text file.
7
6529
by: Entwickler | last post by:
hello, i have the following problem. i want to write a code that enables the user to call functions from a unmanaged code .dll at running time . so i have to use the late binding . i tried the following code but it doesn't walk : Assembly assemblyInstance = Assembly.LoadFrom(@"C:\myData\UnmanagedCode.dll"); i don't know if somebody can help me . Regards,
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10073
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9134
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7609
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5513
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2981
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.