// This example shows how to write a value, timestamp and quality into a single item.
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.
# 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)
exit()
print('Finished.')