KScript includes support for using COM Automation objects to provide information when generating a message or a document. The COM Automation objects provide direct access to a database (usually the ADO library) or may be specific application objects.

The KScript language does not support out parameters, so out parameters are currently not supported on the COM interfaces. Not that the COM interfaces must be based on IDispatch.

Example

This example is based on a simple XML document. Generally a simple XML document like this would not be appropriate in HL7Connect, where either HL7 v2 or CDA content must be generated, so this example cannot be used directly

<Example>
  <%
  cn := CreateCOMObject("ADODB.Connection");
  cn.ConnectionString := "Driver={SQL Server}; Server=(Local); Database=[replace-me]";
  cn.Open;
  %>

  <%
  rs := CreateCOMObject("ADODB.recordset");
  sql:="SELECT [replace-with-fields] FROM [table-name]";
  rs.open(sql, cn);
  %>
  
  <p>Number of Fields: <% rs.Fields.Count %></p>
</Example>

© Kestral Computing P/L 2000-2010.
Keywords: KScript COM support, COM