开发者

Com Interop problem Silverlight 4 and MS Access 2010

开发者 https://www.devze.com 2022-12-21 22:07 出处:网络
I am trying to launch an existing MS Access database (Access 2010) from a Silverlight 4 OOB with elevated authorisation set. I keep getting an error. I can c开发者_运维问答reate a new Access applicati

I am trying to launch an existing MS Access database (Access 2010) from a Silverlight 4 OOB with elevated authorisation set. I keep getting an error. I can c开发者_运维问答reate a new Access application using the CreateObject keyword, but when I try to launch an existing one I get an error: "No object was found registered for specified ProgID."

Any help is appreciated. Here is the code I use:

string sMSAccess = "C:\\Users\\storltx\\Documents\\SL4Demo.accdb";
dynamic MSAccess = ComAutomationFactory.GetObject(sMSAccess);
MSAccess.Visible = true;


I think you should pass "Access.Application" string to GetObject call. like this:

dynamic MSAccess = ComAutomationFactory.GetObject("Access.Application"); 


Try your code like this:-

string sMSAccess = "C:\\Users\\storltx\\Documents\\SL4Demo.accdb";
dynamic app = ComAutomationFactory.CreateObject("Access.Application");
app .Visible = true;
app.OpenCurrentDatabase(sMSAccess);
0

精彩评论

暂无评论...
验证码 换一张
取 消