Problem with SQL Wrapper
As I mentioned earlier, I was looking for a way to add SQL caching capabilities easily into .NET without upsetting, too much code – So I started off with a simple Query/Analyser program –
private void button1_Click(object sender, System.EventArgs e)
{
DataSet resultSet = ExecuteDataSet(this.tbSql.Text,this.tbConnectionString.Text);
this.dataGrid.DataSource = new DataView(resultSet.Tables["sql"]);
}
public DataSet ExecuteDataSet(string sql,string connectionString)
{
DataSet ds = new DataSet();
SqlConnection DSN = new SqlConnection(connectionString);
DSN.Open();
SqlCommand Database = new SqlCommand(sql,DSN);
SqlDataAdapter Adapter = new SqlDataAdapter(Database);
Adapter.Fill(ds,"sql");
DSN.Close();
return ds;
}
Then. tried to create a namespace called CachedSqlClient, which would take all the classes from SqlClient, but modify and extend them to support caching, my first attempt being:
using
System;
using System.Data;
using
System.Data.SqlClient;
namespace CachedSqlClient
{
public class SqlConnecion : System.Data.SqlClient.SqlConnection
{
}
}
But I got the error
C:Documents and SettingsadminMy DocumentsVisual Studio ProjectsBootstrapSQLCacheCachedSqlClientClass1.cs(10): ‘CachedSqlClient.SqlConnecion’ : cannot inherit from sealed class ‘System.Data.SqlClient.SqlConnection’