Ive been testing some code , but there's a error message :(
ComExeption was unhandled .
Requested point does not exits on server .CSM_622_QIA_R9205.pv
I'm sure it exits .....
Some help please .... thx in advance
Module Module1
' Eerst Add reference PISDK.dll
Dim PIServer As PISDK.Server
Private Const PIServerName As String = "HERALD"
Private Const PIUserName As String = "pidemo"
Private Const PIUserPass As String = ""
'_____________________________________________________________________________________________________
Public Function ConnectToPI() As Boolean
Dim bRes As Boolean = False
Dim SDK As New PISDK.PISDK
Try
If PIServer Is Nothing Then PIServer = SDK.Servers(PIServerName)
Try
If Not PIServer.Connected Then PIServer.Open("UID=" & PIUserName & ";PWD=" & PIUserPass)
bRes = PIServer.Connected
Catch ex As Exception
bRes = False
End Try
Catch ex As Exception
bRes = False
End Try
Return bRes
End Function
Sub Main()
Dim startTime As String
Dim endtime As String
Dim duration As String
Dim pt As PISDK.PIPoint
Dim pData As PISDK.PIData
Dim ipid2 As PISDK.PIData
Dim Values As PISDK.PIValues
Dim tagname As String = ("CSM_622_QIA_R9205.PV")
Dim i As Integer
startTime = "28-jul-2011 12:00:00"
endtime = "28-jul-2011 14:00:00"
duration = "30m"
If ConnectToPI() = True Then
Console.WriteLine("U bent geconnecteerd met server " & PIServer.Name.ToString())
Else
Console.WriteLine("U bent niet geconnecteerd")
End If
Console.ReadLine()
pt = PIServer.PIPoints("CSM_622_QIA_R9205.pv") 'get tag pData = pt.Data
ipid2 = pData
Values = ipid2.InterpolatedValues(startTime, endtime, duration)
For i = 1 To Values.Count
Console.WriteLine((Values(i).TimeStamp.LocalDate), "dd-mm-yyyy hh:mm:ss", " ", Values(i).Value)
Next i
Console.ReadLine()
Values = Nothing
ipid2 = Nothing
pData = Nothing
pt = Nothing
PIServer = Nothing
End Sub
End Module