How to determine the version of an MS Access file (.mdb) using C#

I need to find a way to determine which version of Microsoft Access an access fil e is? I know how to open an access file, but not to determine which version the .mdb file is. I need to know how to do this in C#.

 OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=jinkies;");
 
    try
    {
        con.Open();
    }
    catch
    {
        Console.WriteLine("DB Open failed!");
    }

LVL 2
brgdotnetcontractorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tsellsCommented:
Are you trying to determine between Access 2000 and 2007?  If so just check the file extension.


using System.IO;
public enum AccessType
            {
                Access2000,
                Access2007
            }
        
        private AccessType GetTypeFromFile()
        {
            string path = @"D:\Path";
            FileInfo fi = new FileInfo(path);
            if (string.Compare(fi.Extension, "mdb") == 0)
                return Access2000;
            else if (string.Compare(fi.Extension, "accdb") == 0)
                return Access2007;
        }

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brgdotnetcontractorAuthor Commented:
My apologies. I am trying to determine if an access file is version 1997 or 2000 that is what I need to determine.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.