// This example shows how to write a value, timestamp and quality into a single item.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
using System;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.OperationModel;
namespace DocExamples.DataAccess._EasyDAClient
{
class WriteItem
{
public static void Main1()
{
// Instantiate the client object.
var client = new EasyDAClient();
try
{
client.WriteItem("", "OPCLabs.KitServer.2", "Simulation.Register_I4",
12345, DateTime.SpecifyKind(new DateTime(1980, 1, 1), DateTimeKind.Utc), 192);
}
catch (OpcException opcException)
{
Console.WriteLine($"*** Failure: {opcException.GetBaseException().Message}");
return;
}
Console.WriteLine("Success");
}
}
}
# This example shows how to write a value, timestamp and quality into a single item.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc
# Import .NET namespaces.
from System import *
from OpcLabs.EasyOpc.DataAccess import *
from OpcLabs.EasyOpc.OperationModel import *
# Instantiate the client object.
client = EasyDAClient()
# Perform the operation
try:
IEasyDAClientExtension.WriteItem(client, '', 'OPCLabs.KitServer.2', 'Simulation.Register_I4',
12345, DateTime.SpecifyKind(DateTime(1980, 1, 1), DateTimeKind.Utc),
DAQuality(192))
except OpcException as opcException:
print('*** Failure: ' + opcException.GetBaseException().Message, sep='')
exit()
print('Finished.')
' This example shows how to write a value, timestamp and quality into a single item.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
Imports OpcLabs.EasyOpc.DataAccess
Imports OpcLabs.EasyOpc.OperationModel
Namespace DataAccess._EasyDAClient
Partial Friend Class WriteItem
Public Shared Sub Main1()
' Instantiate the client object.
Dim client = New EasyDAClient()
Try
client.WriteItem("", "OPCLabs.KitServer.2", "Simulation.Register_I4",
12345, DateTime.SpecifyKind(New DateTime(1980, 1, 1), DateTimeKind.Utc), 192)
Catch opcException As OpcException
Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
Exit Sub
End Try
Console.WriteLine("Success")
End Sub
End Class
End Namespace