What i am trying is to access the MS Access properties without actually opening the database.

Here is some code to get a better understanding:

var processStartInfo = new ProcessStartInfo(args[0]) 
    { 
        WindowStyle = ProcessWindowStyle.Hidden, 
        CreateNoWindow = true
    };

Process.Start(processStartInfo);

application = (Access.Application)Marshal.GetActiveObject("Access.Application");

dao.Property allowByPassKeyProperty = null;

foreach (dao.Property property in application.CurrentDb().Properties)
{
    if (property.Name == "AllowByPassKey")
    {
        allowByPassKeyProperty = property;
        break;
    }
}

My problem is that in that case, I open the database in order to look for the properties (application.CurrentDb().Properties) and the MS Access startup stuff kicks in.

I want to avoid all the startup stuff, and just inject the right value for the property.

Is it possible to go through the properties, maybe with reflection and late binding like that: http://www.codeproject.com/KB/database/mdbcompact_latebind.aspx?

Or is there any other option to achieve what I'd like?

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top