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.DataJo x.Northwind' does not implement interface member
'System.IDispos able.Dispose()' C:\Documents and Settings\Admini strator\My
Documents\Visua l Studio 2005\Projects\D ataJox\DataJox\ Class1.cs 10 18
Procent.DataJox
and (on the using(Open()) row):
Warning 2 Possible mistaken empty statement C:\Documents and
Settings\Admini strator\My Documents\Visua l Studio
2005\Projects\D ataJox\DataJox\ Class1.cs 16 26 Procent.DataJox
using System;
using System.Collecti ons.Generic;
using System.Text;
using System.Data;
using System.Componen tModel;
using System.Data.Sql Client;
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=localho st;database=nor thwind;trusted_ connection=true ;";
SqlConnection dbconn = new SqlConnection(c onnstr);
}
private void Dispose()
{
Dispose(true);
}
private void Dispose(bool disposing)
{
if (!this.disposed )
{
if (disposing)
{
component.Dispo se();
}
CloseHandle(han dle);
handle = IntPtr.Zero;
}
disposed = true;
}
~Northwind()
{
Dispose(false);
}
}
}
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.DataJo x.Northwind' does not implement interface member
'System.IDispos able.Dispose()' C:\Documents and Settings\Admini strator\My
Documents\Visua l Studio 2005\Projects\D ataJox\DataJox\ Class1.cs 10 18
Procent.DataJox
and (on the using(Open()) row):
Warning 2 Possible mistaken empty statement C:\Documents and
Settings\Admini strator\My Documents\Visua l Studio
2005\Projects\D ataJox\DataJox\ Class1.cs 16 26 Procent.DataJox
using System;
using System.Collecti ons.Generic;
using System.Text;
using System.Data;
using System.Componen tModel;
using System.Data.Sql Client;
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=localho st;database=nor thwind;trusted_ connection=true ;";
SqlConnection dbconn = new SqlConnection(c onnstr);
}
private void Dispose()
{
Dispose(true);
}
private void Dispose(bool disposing)
{
if (!this.disposed )
{
if (disposing)
{
component.Dispo se();
}
CloseHandle(han dle);
handle = IntPtr.Zero;
}
disposed = true;
}
~Northwind()
{
Dispose(false);
}
}
}
Comment