Provider is characterized by an invariant name, a description, and a type that contains assembly and class information. : DbProviderFactories « ADO.net Database « ASP.NET Tutorial






<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" 
    Inherits="Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Listing Factory Objects</title>
</head>
<body>
    <div id="pageContent">
        <form id="form1" runat="server">
            <asp:datagrid runat="server" id="provList" Font-Size="8pt">
                <HeaderStyle Font-Bold="true" />
            </asp:datagrid>
        </form>
    </div>
</body>
</html>

File: Default.aspx.cs

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;


public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable providers = DbProviderFactories.GetFactoryClasses();
        provList.DataSource = providers;
        provList.DataBind();
    }
}








18.34.DbProviderFactories
18.34.1.Provider is characterized by an invariant name, a description, and a type that contains assembly and class information.
18.34.2.By changing the provider name and properly adapting the connection string and command.