|
Please use our Code Center to obtain source-code and example projects/solutions:
http://codecenter.softwaretoolbox.com
|
|
|

|
|
|
|
|

|
|
 Web Based Applications using the OPC Web Client Web Service
Objective
Display the values of a Tag Array in a web-page.
This example assumes that you have the Software Toolbox TOPServer installed, and the default project "simdemo.opf"
is loaded within the TOPServer.
Source Code
ASP.NET
Try 'create an opc web client web-service object Dim objOWC As New OPCLabs.EasyOPCDANet.EasyDAWS
'create a vtq object to receive the tag read 'and also make the call to read the tag Dim objVTQ As OPCLabs.EasyOPCDANet.IVTQNet = objOWC.ReadItem( _
"", _ "SWToolbox.TOPServer", _ "Channel_1.Device_1.TagArray_1")
'check if any errors If Err.Number = 0 Then
'no errors, so check if the tag read is of type array
If IsArray(objVTQ.Value) Then
'tag is an array, iterate thru that array For Each value As Object In objVTQ.Value
'output to the browser Response.Write(value.ToString & "<br>")
Next
Else 'not an array Response.Write("Tag not an array! Value=" & objVTQ.Value)
End If
Else 'error reading the tag Response.Write("Error reading tag: " & Err.Number)
End If
Catch ex As Exception 'send exception messages to the browser Response.Write("Error: " & ex.Message)
End Try
|
|

|
|
|
|

|
|
|