I'm not adding code of myself. I've bought a book, which explains the use of a framework in combination with a database.
The main purpose of the book is to create a framework, where the serverpart of that framework can run local or remote. That means: the database manipulation layer can be local, or can be combined on a server with, for example, SQL Server.
Also a way to completely separate your database layout from your class layout is provided. In .NET, you can use your created classes that inherits from the framework as bindable classes. This way, you are able to create a real encapsulated three tier environment.
If you're interested, the framework is available for free at www.lhotka.net. Explanation of usage you can find here .