DataProviderNameConverter.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / WebControls / DataProviderNameConverter.cs / 1 / DataProviderNameConverter.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Web.UI.Design.WebControls { 
 
    using System.ComponentModel;
    using System.Collections; 
    using System.Data;
    using System.Data.Common;
    using System.Diagnostics;
    using System.Globalization; 
    using System.Web.UI.WebControls;
 
    ///  
    /// Creates a user-selectable list of ADO.net provider names.
    /// The providers are factories to create System.Data objects. 
    /// 
    public class DataProviderNameConverter : StringConverter {

        ///  
        /// Returns a list of the user-friendly provider names.
        ///  
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { 
            DataTable providerTable = DbProviderFactories.GetFactoryClasses();
            DataRowCollection rows = providerTable.Rows; 
            string[] providerNames = new string[rows.Count];
            for (int i = 0; i < rows.Count; i++) {
                providerNames[i] = (string)rows[i]["InvariantName"];
            } 
            return new StandardValuesCollection(providerNames);
        } 
 
        /// 
        ///  
        public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) {
            return false;
        }
 
        /// 
        ///  
        public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { 
            return true;
        } 
    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK