WinCC.net

Home
FAQs
Downloads
Feedback

FAQs

Querying Databases From WinCC Scripts

There are two different methods for querying databases from within WinCC

The ODK functions are tailored for use with the WinCC databases but can be utilised to query external databases.  The functions are part of the ODK option for WinCC.

ADO is an application program interface from Microsoft that lets a programmer access a relational or non-relational database from both Microsoft and other database providers.

 

ODK Database Functions

The Open Development Kit (ODK) option package addresses the open programming interfaces, with which data and functions of the WinCC configuration and the WinCC runtime system can be accessed. The interfaces are designed as C-Application Programming Interfaces (C-APIs).

For example, ODK functions can be used

  • to generate a message
  • to determine the value of a tag
  • to change the object properties in a screen
  • to export a database table

There are a host of functions designed to access/manipulate the WinCC databases.  These functions can be used to reference other Sybase databases however they are limiting when accessing any other databases.

top

ADO

ActiveX Data Objects (ADO) are a set of COM (Component Object Model) objects developed by Microsoft which can be called from WinCC scripts via the OLE Automation interface.  This is the same method used by Active Server Pages (ASP) to publish database information on a web page.

Just as with ASP pages, the limitations of what WinCC can do with a database are determined by the version of ADO being utilised.  For more information on ADO please refer to http://www.microsoft.com/data/ado/default.htm

top


NB: The C script examples use the OLE Automation interface in WinCC which is an unsupported interface. If possible you should try to use the VBS script interface to access objects. The examples have been tested by myself but please be aware that you use them at your own risk.

2007 Salma Ghafoor