开发者

Com Interop problem Silverlight 4 and MS Access 2010

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜