// 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.
class procedure WriteItem.Main;
var
Client: OpcLabs_EasyOpcClassic_TLB._EasyDAClient;
begin
// Instantiate the client object
Client := CoEasyDAClient.Create;
try
Client.WriteItem('', 'OPCLabs.KitServer.2', 'Simulation.Register_I4', 12345, EncodeDate(1980, 1, 1), DAQualities_GoodNonSpecific);
except
on E: EOleException do
begin
WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
Exit;
end;
end;
end;
Rem This example shows how to write a value, timestamp and quality into a single item.
Option Explicit
Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")
On Error Resume Next
Client.WriteItem "", "OPCLabs.KitServer.2", "Simulation.Register_I4", 12345, DateSerial(1980, 1, 1), 192
If Err.Number <> 0 Then
WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
WScript.Quit
End If
On Error Goto 0