<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="Default"%>
Agnostic
File: Default.aspx.cs
using System;
using System.Data;
using System.Data.Common;
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 RunButton_Click(object sender, EventArgs e)
{
string provider = ProviderNameBox.Text;
string connString = ConnectionStringBox.Text;
string commandText = CommandTextBox.Text;
DbProviderFactory fact = DbProviderFactories.GetFactory(provider);
DbConnection conn = fact.CreateConnection();
conn.ConnectionString = connString;
DbDataAdapter adapter = fact.CreateDataAdapter();
adapter.SelectCommand = conn.CreateCommand();
adapter.SelectCommand.CommandText = commandText;
DataTable table = new DataTable();
adapter.Fill(table);
Results.DataSource = table;
Results.DataBind();
}
}