
cause orphan records and code to throw exceptions because If someone comes along that find this application not doing what they want that user can circumvent your application and open the database, make changes and very possibly cause issues in your program e.g.

The second issue is there are several places were the same connection string is duplicated and lastly, the database is not protected with a password which may or may not be needed yet in many cases Creating a dynamic connection will be shown later on. The connection string is hard coded which means to deploy the application to another computer the path needs to be dynamic rather than hardĬode. In the code sample below, data is read from the database in the load event of the form. In this case the developer is novice level with the intent to start off by reading from an employee table and display the data intoĪ DataGridView control with an option to find an employee by last name. The following will lay the background to moving towards writing better code to access a database.


Description Novice level reading and searching See the database design section below for ideas. Up struggling with a bad database design. Without problems that come from writing code without a clear understanding of how to interact with a Microsoft Access (MS-Access) database.īefore a Visual Studio solution is created first work out the database design, test the database to ensure all business requirements are met so that there is a clear path to follow rather than writing code and along the way end In this code sample/article methods which are also best practices will be introduced with the intent to allow a developer to write data centric applications

Working with Microsoft Access database is relatively easy when a developer understands options to interact with a database and has a decent understanding of writing code yet these easy methods that seemingly work can quickly causeĪ developer to encounter problems on every turn of developing a data centric solution for their task.
