Skip to main content

Posts

Showing posts from August, 2013

Automatic class or object maker for Access tables in C#

The entity framework is all very well when you run SQL. But what about all of us that are running Access, or are porting old access systems to the web and need to keep legacy systems in place?

I was keen to us the object data source to work with data and could not find anything that was able make a class for me. So I wrote my own that listed the tables in the database, then created the class file and stored it in the temp directory.

I have a separate code folder to dump these in so that the project does not play with them, rather than dumping them into the App_Code  folder, but you can change this.

I placed this code in the test folder of my app which is called TrackerDotNet

So here is the code:

First the HTML file
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AutoClassMaker.aspx.cs" Inherits="TrackerDotNet.test.AutoClassMaker" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or…