How to create an Access 2000 database from a 64 bit .NET assembly?

959 Views Asked by At

Our application needs to create an .mdb (MS Access 2000) file from VB.NET. We use ADOX for this using as connection string

Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;

This works well. However, now we want to allow 64-bit compilation of our application. As the Jet 4.0 engine is 32-bit only, the Provider in the connection string must be changed to ACE 12.0. When we use this provider however, an MS Access 2010 (.accdb) file is created while we need an MS Access 2000 (.mdb) file.

How can we solve this?

2

There are 2 best solutions below

0
Dabblernl On BEST ANSWER

Well, we tried our luck with

Provider=Microsoft.ACE.OLEDB.12.0;Jet OLEDB:Engine Type=5;

And lo and behold: it seems to work!

0
Gord Thompson On

You could use ACE DAO instead of ADOX, like so:

' required COM reference:
'     Microsoft Office 14.0 Access Database Engine Object Library
' 
' Imports Microsoft.Office.Interop.Access.Dao
'
Dim dbe As New DBEngine
dbe.CreateDatabase("C:\path\foo.mdb", LanguageConstants.dbLangGeneral, DatabaseTypeEnum.dbVersion40)