Hello
I'm trying to create a class that uses northwind database and use the
IDisposable interface thingy :)
Can someone explain why I get:
Error 1 'Procent.DataJox.Northwind' does not implement interface member
'System.IDisposable.Dispose()' C:\Documents and Settings\Administrator\My
Documents\Visual Studio 2005\Projects\DataJox\DataJox\Class1.cs 10 18
Procent.DataJox
and (on the using(Open()) row):
Warning 2 Possible mistaken empty statement C:\Documents and
Settings\Administrator\My Documents\Visual Studio
2005\Projects\DataJox\DataJox\Class1.cs 16 26 Procent.DataJox
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.ComponentModel;
using System.Data.SqlClient;
namespace Procent.DataJox
{
public class Northwind : IDisposable
{
private bool disposed = false;
public DataSet GetAllCustomers()
{
using(Open());
// some code here to get data
}
private void Open()
{
string connstr =
"server=localhost;database=northwind;trusted_conne ction=true;";
SqlConnection dbconn = new SqlConnection(connstr);
}
private void Dispose()
{
Dispose(true);
}
private void Dispose(bool disposing)
{
if (!this.disposed)
{
if (disposing)
{
component.Dispose();
}
CloseHandle(handle);
handle = IntPtr.Zero;
}
disposed = true;
}
~Northwind()
{
Dispose(false);
}
}
}