--Attention please
--This script works in unlimited and trial versions only
--initialize
function OnInit()
host = "energy1"
login ="ecl_admin"
password = "q1w2"
env = odbc.env_create();
CONN,s = odbc.env_connect(env,host,login,password);
if(CONN==nil) then
server.Message(s);
end

end
-- deinitialize
function OnClose()
odbc.conn_close(CONN);
odbc.env_close(env);
end
-- handling
function OnBeforeReading()
cur,s = odbc.conn_execute(CONN,"SELECT name from people_2");
if cur==nil then --если запрос не удалось выполнить
server.Message("s"); --вывод сообщения с ошибкой
end
server.WriteTagByRelativeName("Name",cur,OPC_QUALI TY_GOOD);

end;

-- handling
function OnAfterReading()

end

Не работает.
12-02-2021 07:31:49.371 script:stack traceback:
[C]: at 0x00449b20
[C]: in function 'WriteTagByRelativeName'
[string "--[[(I)SCRIPT.script]]--Attention please..."]:26: in function <[string "--[[(I)SCRIPT.script]]--Attention please..."]:21>