简体   繁体   English

在服务器端运行VBA功能从WCF服务访问数据库

[英]Running VBA functions in a server side Access database from a WCF service

I've been researching for days and I've gotten to the point where my WCF service creates an Access object via com/interop. 我已经研究了几天,我已经到了我的WCF服务通过com / interop创建Access对象的地步。 I've ran the OpenCurrentDatabase call for the Access object without an error but Application.CurrentDB is still nothing/null. 我已经为Access对象运行了OpenCurrentDatabase调用而没有出错,但是Application.CurrentDB仍然没有/ null。 If the CurrentDB is nothing then I surely can't call Application.Run "myFunction" I realize WCF services aren't meant to be user interactive, but it's a long story why I'm trying to go this route. 如果CurrentDB什么都不是,那么我肯定无法调用Application.Run "myFunction"我意识到WCF服务并不意味着用户交互,但这是一个很长的故事,为什么我要尝试这条路线。 Basically I need to have a proof of concept ready sooner rather than later and the alternative (correct) route involves the complete re-writing of a large complex access VBA application. 基本上我需要尽早准备好概念证明,而替代(正确)路由涉及完全重写大型复杂访问VBA应用程序。 It's not a permissions issue, I have the IIS user names added to the security tab. 这不是权限问题,我将IIS用户名添加到安全选项卡。 What I really need is a way to set Environment.UserInteractive to true so my WCF service can create an instance of Access on my server machine, run the VBA functions, close out, return true. 我真正需要的是一种将Environment.UserInteractive设置为true的方法,这样我的WCF服务就可以在我的服务器上创建一个Access实例,运行VBA函数,关闭,返回true。 I'm using VS 2010 for the WCF, IIS 7 for my server, Access 2010 for the VBA application. 我将VS 2010用于WCF,IIS 7用于我的服务器,Access 2010用于VBA应用程序。 Please help! 请帮忙!

The answer is to have the WCF service write the access macro name to a database and have a desktop application on the server machine monitor the database. 答案是让WCF服务将访问宏名称写入数据库,并让服务器计算机上的桌面应用程序监视数据库。 The desktop application loads access, performs the actions, and writes back to the database upon completion. 桌面应用程序加载访问,执行操作,并在完成后写回数据库。 The WCF service monitors the database waiting for an "operation complete" status and returns the result. WCF服务监视数据库,等待“操作完成”状态并返回结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM