.NET
  Home arrow .NET arrow Page 2 - The Provider Factory in ADO.NET 2.0
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

The Provider Factory in ADO.NET 2.0
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 7
    2006-08-09

    Table of Contents:
  • The Provider Factory in ADO.NET 2.0
  • Data Providers on This Machine
  • More Data Providers on This Machine
  • Creating Provider Independent Data Access

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The Provider Factory in ADO.NET 2.0 - Data Providers on This Machine


    (Page 2 of 4 )

    In order to find a specific DbProviderFactory on this machine let us place a button and a textbox and use the GetFactory(string) method as shown from its definition in the object browser (copied from the ObjectBrowser in VS 2005).

    GetFactory(string) As SYStem.Data.Common.DbProviderFactory

    Public Shared Function GetFactory(ByVal providerInvariantName As String)
    As & _ System.Data.Common.DbProviderFactory Member of: System.Data.Common.DbProviderFactories Summary: Returns an instance of a System.Data.Common.DbProviderFactory. Parameters: providerInvariantName: Invariant name of a provider. Return Values: An instance of a System.Data.Common.DbProviderFactory for a specified
    provider name.

    All providers have what is called a providerInvariantName. This GetFactory() method needs to be called by providing a providerInvariantName as a string. To the click event of the button add the following code. It is assumed that you have the imports statements (System.Data and System.Data.Common) in place.

     Protected Sub Button2_Click(ByVal sender As Object, ByVal e As 
    System.EventArgs) Handles Button2.Click Dim strg As System.Data.Common.DbProviderFactory dstrg = Data.Common.DbProviderFactories.GetFactory
    ("System.Data.SqlClient") TextBox1.Text = dstrg.ToString End Sub

    The above code returns the following as the reference to the DbProviderFactory.

    More .NET Articles
    More By Jayaram Krishnaswamy


       · Yes, that is true, more power with less coding. In an earlier tutorial,'Using the...
     

    .NET ARTICLES

    - Using CrystalReportViewer to Display Crystal...
    - Creating Summary .Net Crystal Reports
    - More on Commands, Input and the WPF
    - Grouping and Aggregating When Querying LINQ ...
    - Commands, Input and the WPF
    - Keyboard and Ink Input with WPF
    - Mouse Input and the WPF
    - Input with Windows Presentation Foundation
    - Introducing LINQ with XML and Databases
    - An Introduction to LINQ
    - Querying LINQ to SQL: Basics
    - Completing a Simple Storefront with LINQ
    - Knowing Your Environment: the System.Environ...
    - Creating the Home Page for a Simple Storefro...
    - LINQ Quickly with Language Integrated Queries

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT