I have a really strange problem with ADOX Interop.
I have this code:
try
{
if (File.Exists(path))
File.Delete(path);
var cat = new CatalogClass();
cat.Create("Provider=Microsoft.Jet.OLEDB.4.0; Data Source = d:\\Test.mdb; Jet OLEDB:Engine Type=5");
Marshal.ReleaseComObject(cat);
cat = null;
GC.Collect();
}
catch (FileNotFoundException e)
{
throw new FileNotFoundException("El archivo no se encuentra", e);
}
catch (COMException e)
{
throw new COMException(connStr + e.Message);
}
catch (Exception e)
{
throw new Exception(connStr, e);
}
The code is failing in the cat.Create() line. What is really weird is that on my local developer machine it works fine, but in the production server doesn't... It isn't a write permissions problem, because i have tried to generate a random file before the problem line and worked perfectly. The COMException message is only "Not specified Error" HResult: -2147467259
The Server OS is Windows 2008 32bits. I think is a server configuration issue, but can you give me some light? I don't know what else I can do...
If you deploy your application on a 64 bit machine your code couldn't use ADOX via JET.OleDB.4.0
If this is the case, then, a fast solution could be to change your target architecture to x86.
Otherwise you could try to download and install on the target machine the 64bit version of Microsoft Access Database Engine drivers, but I don't know if they support ADOX. You will also need to change your connection string