Different databases

J

Jim

I have a program that uses an Access database (old.mdb). I am in the process
of updating the program and wish to use a similar but enhanced database
(new.mdb) that shares many of the old fields. My question is what is the
best way to differentiate one database from the other ? The old program is
written in VB6, the new is in C#. If an old database is recognized, I plan
to convert the data to the new database. Is this the best plan ?
I am not looking for specific code but would like to find out the best
methods.
Thanks in advance for your help,
Jim
 
C

CompGeek78

I have a program that uses an Access database (old.mdb).  I am in the process
of updating the program and wish to use a similar but enhanced database
(new.mdb) that shares many of the old fields.  My question is what is the
best way to differentiate one database from the other ?  The old program is
written in VB6, the new is in C#.   If an old database is recognized, Iplan
to convert the data to the new database.  Is this the best plan ?  
I am not looking for specific code but would like to find out the best
methods.
Thanks in advance for your help,
Jim

Are the file names really old.mdb and new.mdb?
 
J

Jim

The databases could be named UsersChoiceOldFormat.mdb
and UsersChoiceNewFormat.mdb.
I used the new and old as an example and for simplicity.
I am still looking for the best method or approach to tell the database with
the old format from the one with the new format.
Thanks for your help in advance,
Jim
 
A

Arvin Meyer [MVP]

Names are the Windows way of working with files. With Access mdb's you can
also use custom properties and reference those properties. I have no idea
how you'd do it in C#, but VBA is almost bit for bit identical to VB6. The
VBA method to create a custom property, and then return that property is
demo'd in:

http://www.datastrat.com/Download/Starter.zip
 
C

CompGeek78

Names are the Windows way of working with files. With Access mdb's you can
also use custom properties and reference those properties. I have no idea
how you'd do it in C#, but VBA is almost bit for bit identical to VB6. The
VBA method to create a custom property, and then return that property is
demo'd in:

http://www.datastrat.com/Download/Starter.zip

Maybe I don't quite get what you're asking, but if the databases have
different names, why can't you just reference the name of the mdb you
are accessing?
 
J

Jim

I am sorry for not being clearer.
I distribute my program to a user.
The user starts the program and is asked for the name of the database they
will be using.
The program now needs to determine if the user has selected a database of
the old format or of the new format. I am not looking for code. I am just
interested is a method that will let the program determine old or new. What
is the easiest feature to look for? A solution in VBA would be acceptable.
Thanks for your help,
Jim
 
C

CompGeek78

I am sorry for not being clearer.
I distribute my program to a user.
The user starts the program and is asked for the name of the database they
will be using.
The program now needs to determine if the user has selected a database of
the old format or of the new format.  I am not looking for code.  I am just
interested is a method that will let the program determine old or new.  What
is the easiest feature to look for?  A solution in VBA would be acceptable.
Thanks for your help,
Jim

If the user picks the file from some control in your program, can't
you just use an if statement to determine which filename they chose?

If the name of the database isn't something that is standardized, then
I would suggest either following Arvin's concept of the custom
property or creating a table with a version number field that you use
to track version information. Personally, I like Arvin's concept
better because version information is not data, it's meta-data and
having a property to store that makes more sense.

Keven Denen
 
J

John Spencer

If the table structure is different then examine the table structure.

For example, the old version has 10 fields in an employee table and the
new version has 11 fields in the equivalent employee table. Or Old
version has 15 tables and the new version has 17 tables.

You could even step through the all the tables to make sure the user has
selected a correct database.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top