some fun with C#

The only problem I had to deal with in my quickie switch from interland to dreamhost was changing the Unit Circle store from ASP pages to something else (I haven’t decided if I’m going to do a Flex thing, a zencart thing or a PhP thing yet). The first hurdle I had to deal with was that the old store used an Microsoft Access database backend. I’ve switched 100% to macs and my old PC was dead, so I couldn’t load the mdb file on my home machines, at work we don’t have the full office license, so I couldn’t use Access on my work PC. I searched around the web and found some shareware that theoretically could convert from MDB files to other types of files, but none that I tried worked very well (if at all). What I did have on my work machine was Visual Studio. On a whim, I opened up the server tab and tried adding the access file AND IT WORKED! I could browse the tables, but there was no way in VS to export them. So I wrote up a quickie C# app, which I’m posting here. Ya know, for the kids.

Some caveats:

  • I haven’t written C# professionally for a couple years.
  • I haven’t added the code to actually grab the table list from the access file and enumerate those. It is left as an exercise for the reader.
  • It doesn’t handle quoted values in table values explicitly (it passes them through, but any CSV importer will get confused).
  • I wrote it in about 20 minutes.
  • In other words, don’t judge my coding skills from this.

Here is the code.

By the way, I had formatted the code using the C# code formatter on which is very cool, but it completely screwed up my blog layout due to the <pre> statements and long lines. So I put it in the separate page.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.