关于在C#中添加引用 OPC Automation 2.0组件的导致添加组时出错的问题??
关于在C#中添加引用 OPC Automation 2.0组件的导致添加组时出错的问题??
使用的OPC服务器是 Simatic NET安装的
操作系统:Win2K
编程环境:Microsoft Visual C#.Net 2003
采用方法:前期引用绑定
出现问题:
private OPCAutomation.OPCServerClass OPCServer;
private OPCAutomation.OPCGroup OPCGroup;
private OPCAutomation.OPCItem OPCItem;
OPCServer=new OPCAutomation.OPCServerClass();
this.OPCServer.Connect("OPC.SimaticNET",0);
OPCAutomation.OPCGroupsClass temp=new OPCAutomation.OPCGroupsClass();//运行此句时提示错误:“带有 CLSID {28E68F9E-8D75-11D1-8DC3-3C302A000000} 的 COM 对象无效或未注册。”
this.OPCServer.OPCGroups.Add("Grp1");
this.OPCItem= this.OPCGroup.OPCItems.AddItem("S7:[DEMO]DB10,INT0,10",0);
安装软件带的 VB、VC++等的例子能运行成功,读取正确。
但是将VC++的工程升级到 .Net后也会引起错误。
请各位斑竹和专家帮忙看看,如果能提供一个C#的例子更好。