Home > Uncategorized > Problem with SQL Wrapper

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’

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s