代码连接服务器成功,可以读取到服务器节点,但是调用SyncRead读取数据的方法时报错
找了好多资料都找不到错误点在哪,求各位大神支招。附代码
public void kepProcess()
{
KepGroup = KepGroups.Add("Group0");
KepGroup.UpdateRate = 250;
KepGroup.IsActive = true;
KepGroup.IsSubscribed = true;
//当KepGroup中数据发生改变的触发事件
KepGroup.DataChange += new DIOPCGroupEvent_DataChangeEventHandler(KepGroup_DataChange);
KepItems = KepGroup.OPCItems;
int[] temp = new int[2];
temp[0] = 0;
KepItems.AddItem("Random Int1", 1);
OPCItem bItem = KepItems.Item(1);
Array serverHandles = (Array)temp;
Array values;
Array Errors;
Object cancel;
Object Qualities;
KepGroup.SyncRead((short)OPCAutomation.OPCDataSource.OPCCache, serverHandles.Length, ref serverHandles, out values, out Errors, out Qualities, out cancel);
}