BOOL IsActive ()//是否激活?
pUnkGroup->SetActive(TRUE,TURE)
另个需保证OPC地址验证要通过
启动流程
先启动OPC驱动
if(!pOpcServer->IsAlive())
pOpcServer->Start()
AddOpcItem(XXX,XXX,XXX)//往OPC的某个组增加Item
COPCItem* AddOpcItem(COPCServer *pOpcServer,COPCGroup *pOpcGroup,CVarObj *pVarObj)
{
if(pOpcServer &&pOpcGroup &&pVarObj)
{
COPCItem *pItem = new COPCItem (pOpcGroup)
// Set item properties:
pItem->SetAccessPath (pVarObj->m_strAccessPath)
pItem->SetActive (pVarObj->m_bEnable)
pItem->SetDataType (pVarObj->m_vtData)
pItem->SetItemID (pVarObj->m_strAddress)
// 验证地址
if(pOpcGroup->ValidateItem(pVarObj->m_strAddress,pVarObj->m_strAccessPath,pVarObj->m_vtData))
{
CObArray cList
cList.Add(pItem)
int cnItems = cList.GetSize()
pOpcGroup->AddItems (cList, cnItems)
return pItem
}
else
{
delete pItem
}
}
return NULL
}
主要是的SQL语句写的有问题,另外还要注意时差,你用下面这个试试:
_bstr_t exesql("TAG:R,'ProcessValueArchive\\NewTag1_inter','0000-00-00 00:10:00.000','0000-00-00 00:00:00.000'") //读最近10分钟的数据
字段见附图:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)