Thank you, Geert!
Well, it was horrible code, indeed

I rewrite it without SQL.
Your code will help me in other ideas, thank you again.
Mick
Sub main
On Error Resume Next
Err.Clear
Repository.EnsureOutputVisible "Script"
Repository.ClearOutput "Script"
dim msg, appName
appName = "A&D VBScript"
if Err.Number <> 0 Then
Session.Output( "NOK" )
msg=MsgBox( "Unknown Error.", vbOKOnly + vbExclamation , appName )
Exit Sub
else
dim currentDiagram as EA.Diagram
set currentDiagram = Repository.GetCurrentDiagram()
'Selected element type=Component check.
if currentDiagram.SelectedObjects.Count = 0 then
msg=MsgBox("Select 'Component' element.", vbOKOnly + vbExclamation , appName)
Exit Sub
else
for each currentDiagram in currentDiagram.SelectedObjects
dim theElement as EA.Element
set theElement = Repository.GetElementByID(currentDiagram.ElementID)
if theElement.Stereotype <> "Component" then
msg=MsgBox("Select 'Component' element.", vbOKOnly + vbExclamation , appName)
Exit Sub
else
'Check the element has connector.
dim con as EA.Element
set con = theElement.Connectors.GetAt(0)
dim client as EA.Element
set client = Repository.GetElementByID (con.SupplierID )
if client.Name = "" then
msg=MsgBox("The connector is missing.", vbOKOnly + vbExclamation , appName)
Exit Sub
else
'Check connector type = Usage.
if con.Type <> "Usage" then
msg=MsgBox("The connector type must be a 'Usage.'", vbOKOnly + vbExclamation , appName)
Exit Sub
else
set theElement = Repository.GetElementByID(client.ElementID)
dim theComponent as EA.Element
set theComponent = Repository.GetElementByID(currentDiagram.ElementID)
dim i
dim attributes as EA.Collection
set attributes = theElement.EmbeddedElements
for i = 0 to attributes.Count - 1
dim currentAttribute as EA.Element
set currentAttribute = attributes.GetAt( i )
'pondelok, 09 augusta 2021, 15:19:32
'check service name.
dim serviceName
serviceName = currentAttribute.name
if instr(1,serviceName,"(") <> 0 then
serviceName = mid(serviceName, 1, instr(1,serviceName,"(") - 1)
else
serviceName = serviceName
end if
'Session.Output("serviceName: " & serviceName)
'copy webpage interface to the component element
Call AddOperation (currentDiagram.ElementID, serviceName, currentAttribute.Notes)
next
end if
end if
end if
next
end if
end if
End Sub