Tagged: Coding, Database, DotNet
If you're a big iron RDBMS coder, consider that dynamically created Jet files as middleware have come in very handy for lots of folks using Oracle and SQLServer in the enterprise, so this is not just a power for those using Jet as a core source.
Years ago we noticed that we were spending more time writing DAO object code than working with data. So we took an afternoon and wrote the first SmithVoice.com DBCodeCreator. It saved us lot of time and other devs seemed to like it so we started giving it away on the SmithVoice.com sitelett.
A couple of years later ADO/x 2.1 finally made doing data object creation worthwhile so we re-wrote the functionality and added some gui features including checkable listboxes so devs could pick exactly the objects they needed to make. (That became an even more popular download than the DAO version and was recently featured in Mike Gunderloy's Sybex Press book "ADO AND ADO.NET Programming".)
Like everything else .Net, converting this applet to .net was not exactly a simple a port, but a bit of experience later it was done. And now, like the other versions, it's free for you.
If you've used any of the other releases, then running the vb.net version should be pretty obvious. You press the "Choose Source" button and pick a Jet database then you watch the tables, Views (non-parameter queries) and Procs (parameter queries) load up into the list boxes.
Check the objects you need to put in your new databases. As with the previous versions, if a View/Proc is checked then all of the tables it requires will automatically be checked, and if you uncheck a table, all of it's dependant Views and Procs will be un-checked. Plus, right-clicking a View/Proc pops up a context menu letting you see the Command Text (helpful for Unions which do not expose BASETABLEs and so can't automatically deal with their related objects).
When all the objects you need are checked, just press the "Make /Show Code" button and the VB.net ADO/x code is written for you and displayed in the rtb.
You can copy the generated code to the clipboard or choose to have the app write it into a *.vb module file.
No muss, no fuss ;-)
As with all the previous versions, you get all of the indexes and all of the column properties, even the undocumented ones. The caveat being that relations are not dealt with (they are not a major performance booster to most Jet apps).
In case you're wondering if this writes ADO.net code ... it's doesn't. ADO.net does not have any of the functionality of ADO/x. Maybe when the connected cursor library is released it will have some good features, but we'll have to wait and see. For now, the only way to programmatically create a Jet database is via Interop. In the source of the applet there is a bit of utility code written with ADO.net but that was just to show that ADO.com and ADO.net can peacefully exist in a single assembly, the use of ADO.net added nothing special to the end result.
In the zip, you'll get the exe and, the two Interop.ADO dlls and, for non VS.net users, the PIA adodb.dll. Just pop all of these in a folder on your machine and let it start writing your ADO/x code. To use that code, just drop the created module onto a VB.net project tree and call the entry point like this:
bDone = MadeNewAdoJetDB([
if bDone then Messagebox.Show(
Click here to get the exe. (Just 60k)
As with the other versions, the source code is available for free. Agreement is that you won't publish and call it your own [funny, but it's been called to our attention a couplea codeproject times :) ]). If you agree to that, then here you are.
And, for a lot more Jet information, poke around the SmithVoice.com Database Tools & Tips pages.
Hope it helps!