0
我在寫一個代碼,它從OPC服務器讀取數據。OPC服務器添加項錯誤HResult
public void setOPC()
{
int count = 1;
try
{
opcServer = new OPCServer();
opcServer.Connect("OPCTechs.SiemensNet30DA", "");
opcServer.OPCGroups.DefaultGroupIsActive = true;
opcServer.OPCGroups.DefaultGroupDeadband = 0f;
opcServer.OPCGroups.DefaultGroupUpdateRate = 10;
opcGroup = opcServer.OPCGroups.Add("MP");
opcGroup.IsSubscribed = false;
opcGroup.OPCItems.DefaultIsActive = false;
int[] h = new int[844];
for (int i = 69; i >= 60; i--, count++)
{
h[count] = opcGroup.OPCItems.AddItem("HH1001.B" + i, count).ServerHandle;
}
for (int i = 69; i >= 60; i--, count++)
{
h[count] = opcGroup.OPCItems.AddItem("GF1001OP190.B" + i, count).ServerHandle;
}
}
在上面的代碼,在執行時,第二環&到達線
h[count] = opcGroup.OPCItems.AddItem("GF1001OP190.B" + i, count).ServerHandle;
它給出了錯誤
Exception from HRESULT: 0x0040007
如果執行第一環路AddItem
成功,爲什麼它給第二個問題?