Click here to Skip to main content
15,894,646 members
Articles / Programming Languages / XML

Create Data Classes

Rate me:
Please Sign up or sign in to vote.
4.88/5 (31 votes)
4 Mar 2011CPOL10 min read 135.8K   2.5K   167  
An application that creates a C# class to read/write data to/from an Access, SQLite, or XML database.
Before you start using the program you MUST do the following:

Decide if you want to keep your saved projects in an Access DB or in a SQLite DB.
Start the program, if it can't find the database it needs most options will be disabled, but it will switch to the Miscellaneous functions control.
You must now tell the program what DB to use and where to find it.
Go to Other Functions -> Miscellaneous (this control should already be visible if the program couldn't find the database).
There is a Group Box with the text 'Copy Original Files To App Settings Folder' - click the 'Fill List' button.
The full path of the two DB files should appear in the List View.
Tick the one you want to use and then click 'Copy Files'
The file will be copied to the Application Settings Folder (this keeps it Vista/Win7 friendly)
Go to Settings -> Options on the main menu, indicate the DB type and use the file picker to navigate to the appropriate DB file then press 'Save' and 'Close'
The program will then enable and fill various controls as it now knows where the DB is.

You only have to do this once, but you will have to go through the last stage of telling the program about the type and location of the DB if you run it outside the IDE - the setting will NOT carry over from a program run in the IDE to one run outside the IDE.

The program is now ready for use. If you have saved projects from a previous version, in a file called:
Access 12 - JGSavedProjects.accdb
Previous Access Versions - JGSavedProjects.mdb
XML - JGSavedProjects.xml

then you can import those projects as follows:

Go to the Main Menu 'Project Conversion' -> 'Import Previous Projects'
A dialog will appear
Select the Source DB type
Use the File Picker to navigate to the source DB file
Select the table name
Click the 'Convert' button
It may take a while depending on the number of records to convert and import.
When it is complete a message will appear telling you how many records have been imported.
Click the 'Close' button.
Go to Saved projects -> View Saved projects and click the 'Refresh List' button when all the saved projects should be listed.

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Retired
United Kingdom United Kingdom
I have been a keen hobbyist programmer since getting my first computer - a Vic 20 (you had to be able to write programs then since few programs were available and all were expensive).
Retired and now living in Pewsey, Wiltshire, where I spend (far too much of) my time writing computer programs to keep my mind active.

Comments and Discussions