这是西门子官网的脚本实例,我我替换了用户归档名称和导出路径,目前,只有删除用户归档数据能实现,导出归档数据不能实现。不知道问题出在哪里?谢谢!
{
UAHCONNECT hConnect = 0;
UAHARCHIVE hArchive = 0;
//------------------------------------------------------------------
// Folgende Ebenen m黶sen unbedingt eingehalten werden:
// uaConnect <--> uaDisconnect
// uaQueryArchiveByName <--> uaReleaseArchive
// uaArchiveOpen <--> uaArchiveClose
if ( uaConnect( &hConnect ) )
{
if ( uaQueryArchiveByName( hConnect, "Process", &hArchive ) ) //***!! Adjust the archive name !!*****************
{
if ( uaArchiveOpen( hArchive ) )
{
//----------------------------------------------------------------------------------------------
//**************************** Delete all Records ****************************
uaArchiveExport(hArchive,"C:\Users\DLES\Desktop\Export.csv",0,0);
//******************Export all Records of the CSV-File *************************
//************* !! Adjust the Filename of the CSV-File !!***************************
uaArchiveDelete( hArchive, "");
//-----------------------------------------------------------------------------
uaArchiveClose( hArchive );
}
else
{
printf( "Open failed.\r\n",uaGetLastError() );
}
uaReleaseArchive( hArchive );
}
else
{
printf( "Query failed.\r\n",uaGetLastError() );
}
uaDisconnect( hConnect );
}
else
{
printf( "Connect failed.\r\n",uaGetLastError() );
}
}
最佳答案
把uaArchiveExport(hArchive,"C:\Users\DLES\Desktop\Export.csv",0,0); 中保存路径修改为"C:\\Users\\DLES\\Desktop\\Export.csv"
提问者对于答案的评价:
谢谢大师,问题解决了!
最佳答案作者回复:
过奖了,问题解决了就好
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc312717.html