Kenneth.Rice

Unauthorized Access Exception

Discussion created by Kenneth.Rice on Aug 31, 2011
Latest reply on Sep 1, 2011 by Ahmad Fattahi

Hi all,

 

Its been quite a while since I have been able to post to VCampus and that makes me sad. Been very busy trying to learn new SCADA system, Cisco Systems and not enough PI, not good to have PI withdrawls....

 

I could use some help with ane error ...

 

This code was written and ran sucessfully against PI Server before version WIS (3.4.380.36), our current version. I suspect that the new version is contributing to my problem, not the server itself but the fact that my coding should and has to be different, and I dont have a lot of time to dig deep hence could "Batman" or any of the other "super stars" on this site be so kind to school me.

 

Also this code always did seem to take "too long" any cunstructive critism on improving performance would be appreciated

 

The error comes at line

 

nvsSum = ipid.Summaries2("-5m", "*", "", ArchiveSummariesTypeConstants.asCount, CalculationBasisConstants.cbEventWeighted)
            valTot = nvsSum("Count").Value

 

and reads

 

Insufficient permission to access or complete operation.[-10400] No Read Access - Secure Object

 

Thanks in Advance

 
        Dim g_pi As New PISDK.PISDK
        Dim srv As Server

        srv = g_pi.Servers.Item("x")
        srv.Open("UID=pidemo;PWD= ")

        Dim ipid As IPIData2
        Dim pdata As PIData
        Dim nvsSum As NamedValues
        Dim valTot As PIValues
        Dim pt As PIPoint
        Dim strQuery As String
        Dim ptList As PointList
        ptList = New PointList
        Dim ptCnt As Integer

        Dim pointNameCounter As Integer
        Dim eventCounter As Integer
        ' Set the value of the counter variable.
        pointNameCounter = 0
        eventCounter = 0

        strQuery = "Tag LIKE '*'"
        ptList = srv.GetPointsSQL(strQuery)


        ptCnt = CInt(ptList.Count)


        For Each pt In ptList
            pdata = pt.Data
            ipid = pdata

            nvsSum = ipid.Summaries2("-5m", "*", "", ArchiveSummariesTypeConstants.asCount, CalculationBasisConstants.cbEventWeighted)
            valTot = nvsSum("Count").Value

            For m = 1 To valTot.Count
                eventCounter = valTot(m).Value + eventCounter
            Next

            pointNameCounter = pointNameCounter + valTot.Count
        Next

        Label2.Text = pointNameCounter
        Label1.Text = eventCounter
srv.Close()

 

Outcomes