Monthly Archives

40 Articles

Posted by Ronald Anthonissen on

Using an Access Database in your C# application

I’m currently working on 2 (.NET WinForms) projects that need a generic data provider.  I use Access while developing, but the application must also work with SQL Server, MSDE, MySQL, PostgreSQL or another database system if necessary.  With my background of web application developer, I started of by using the principle of Data Transfer Objects (DTO) Pattern.  Storing database information in a custom, dumb, database-independent object.
As the project grew and the application got heavier and heavier, the DTO principle gave me more and more trouble.
That’s why I today took the decision to take another road and use the built-in data providers (that’s why they were there in the very beginning of .NET) and use the Factory Pattern to allow switching databases with a setting in a configuration file.
Things go a lot easier now, and it certainly proofs that I still have a lot to learn about .NET WinForm programming.  Look like it’s time to prepare for another Microsoft (WinForms) exam (70-306 or 70-316: Developing and Implementing Windows®-based Applications , they’re both the same, except for the language).  That would bring the count on 3 (I’ve already taken exam 70-315: Developing and Implementing Web Applications with Microsoft Visual C#™ .NET and Microsoft Visual Studio .NET and exam 70-320: Developing XML Web Services and Server Components with Microsoft Visual C# and the Microsoft .NET Framework.
But now let’s go and use the full power DataAdapters and DataSets!