Professional Documents
Culture Documents
. 1 14
https://gcsresource.invensys.com/support/Wonderware/UtilityReadme/t...
wwGenericSQLGrid
All Tech Notes, Tech Alerts and KBCD documents and software are provided "as is" without warranty of any
kind. See the Terms of Use for more information.
Topic#: 001046
Created: July 2002
Updated: May 2007
Updated: July 2008
Introduction
The wwGenericSQLGrid is a data access object written to operate within the InTouch ActiveX
container. The object can be used for a grid representation of data from a relational database. The
current release is recommended to access MS SQL Server via OLEDB. The object's appearance can
be modified by the settings on the property page as well as through methods and properties at
runtime.
Installation is simple and takes advantage of the Window installer. The grid is installed by running
the wwGenericSQLGrid.msi file that is part of the distribution package. Although this control was
created specifically for use within InTouch it can be used in any suitable ActiveX container. An
example of a use within InTouch might be to give an operator visibility into the customer order
system allowing them to view the daily schedule. Another use might be to access recipe information
and extract that data for use in the control system.
22.09.2016 9:21
wwGenericSQLGrid
. 2 14
https://gcsresource.invensys.com/support/Wonderware/UtilityReadme/t...
FIGURE 1: DOUBLE-CLICK
FILE
WWGENERIC SQLGRID
SETUP
22.09.2016 9:21
wwGenericSQLGrid
. 3 14
https://gcsresource.invensys.com/support/Wonderware/UtilityReadme/t...
22.09.2016 9:21
wwGenericSQLGrid
. 4 14
https://gcsresource.invensys.com/support/Wonderware/UtilityReadme/t...
22.09.2016 9:21
wwGenericSQLGrid
. 5 14
https://gcsresource.invensys.com/support/Wonderware/UtilityReadme/t...
22.09.2016 9:21
wwGenericSQLGrid
. 6 14
https://gcsresource.invensys.com/support/Wonderware/UtilityReadme/t...
22.09.2016 9:21
wwGenericSQLGrid
. 7 14
https://gcsresource.invensys.com/support/Wonderware/UtilityReadme/t...
ON
WINDOW
Property Name
Type
Description
R/W
ServerName
String
R/W
22.09.2016 9:21
wwGenericSQLGrid
. 8 14
https://gcsresource.invensys.com/support/Wonderware/UtilityReadme/t...
DatabaseName
String
R/W
UserName
String
R/W
Password
String
R/W
Caption
String
R/W
FillColor
R/W
FillStyle
R/W
Font
R/W
MaxRecords
Long
SQLString
String
RowCount
Long
EOF
Boolean
Enabled
Boolean
BOF
Boolean
ConnectionString
String
R/W
ConnectionTimeOut Long
R/W
ColumnHeaders
R/W
Boolean
R/W
Methods
ActiveX control methods are similar to ActiveX control properties. ActiveX control methods are
accessed through ActiveX Event scripts and/or InTouch QuickScripts.
22.09.2016 9:21
wwGenericSQLGrid
. 9 14
https://gcsresource.invensys.com/support/Wonderware/UtilityReadme/t...
22.09.2016 9:21
wwGenericSQLGrid
. 10 14
https://gcsresource.invensys.com/support/Wonderware/UtilityReadme/t...
Method Name
Connect()
Return
Description
Type
N/A
ConnectWithString
N/A
Clear()
N/A
Execute()
GetRowColumnValue() String
22.09.2016 9:21
wwGenericSQLGrid
. 11 14
https://gcsresource.invensys.com/support/Wonderware/UtilityReadme/t...
GetSelectedCellValue() String
GetRowNumber()
Long
GetColumnNumber()
Long
ColumnValue()
String
MoveFirst()
N/A
MoveLast()
N/A
MovePrevious()
N/A
Movenext()
N/A
About()
N/A
SQLStringAppend()
N/A
Disconnect()
N/A
PrintGrid()
N/A
22.09.2016 9:21
wwGenericSQLGrid
https://gcsresource.invensys.com/support/Wonderware/UtilityReadme/t...
GetColumnWidth()
SetColumnWidth()
N/A
SetColumnVisible()
N/A
GetCoulmnVisible()
Boolean
Events
Click - This event is triggered every time the user clicks on the area of the control.
SelChange - This event is triggered every time the user clicks on the "row selector" i.e the
grey area on the far left hand side of the Grid.
SelectionChanged - This event is triggered when the user changes rows by clicking directly
within a cell.
ColumnWidthChanged - This event is triggered when the Column width is changed.
These events can be used in conjunction with the methods and properties to control the behavior of
the control as well as to extract data from user selections.
Examples
The distribution package you received should contain an InTouch demo application that exercises all
the capabilities of the wwGenericDataGrid.
The following code can be run directly in InTouch quickscripts.
Below is an example to connect the grid to a Database:
#Grid1.Server = Server;
#Grid1.Database = Database;
#Grid1.UserID = UserID;
#Grid1.Password = Password;
#Grid1.Connect();
#Grid1.PrintGrid( "c:\", "myEbook.xls", 1);
To get a specific value from a cell:
. 12 14
22.09.2016 9:21
wwGenericSQLGrid
https://gcsresource.invensys.com/support/Wonderware/UtilityReadme/t...
Selection = #Grid1.GetSelectedCellValue();
To get the number of rows currently listed in the grid:
NumberOfRows = #Grid1.NumberOfRows;
The example above utilizes an object named Grid1. Dropping an instance of the object on a window
and naming it Grid1 makes it possible to use the example exactly as it appears.
Since there is no method or property to change the column headings on the grid, utilize your query
to accomplish this task. This can be done by specifying AS with a title in your query. The following
is a simple example that selects the last name from the author's table and displays it as Last Name.
Connection Strings
Connection strings can be used to connect to a variety of different data sources.
To connect to a data source, you would use the ConnectWithString() method and pass the proper
connection string. For more details on connection strings check ADO documentation.
The following strings are a provided for common data sources:
ODBC
Provider=MSDASQL.1;Password=PWD;Persist Security
Info=True;User ID=UID;Data Source=TheDSN;Initial
Catalog=THEDB
ORACLE
Provider=MSDAORA.1;Password=PWD;User ID=UID;Data
Source=OrServer;Persist Security Info=True
SQLServer
Provider=SQLOLEDB.1;Password=PWD;Persist Security
Info=True;User ID=UID;Initial Catalog=TheDATABASE;Data
Source=SQLServer
Jet 3.51
Provider=Microsoft.Jet.OLEDB.3.51;Password=myPWD;Persist
Security Info=True;User ID=myUID;Data Source=MyDB.mdb
Jet 4.0
Provider=Microsoft.Jet.OLEDB.4.0;Password=myPWD;Persist
Security Info=True;User ID=myUID;Data Source=C:\NWIND.MDB
The following table lists OLE DB connection strings for several OLE DB data sources:
. 13 14
Data Source
Microsoft Access
Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=physical path to .mdb file
22.09.2016 9:21
wwGenericSQLGrid
https://gcsresource.invensys.com/support/Wonderware/UtilityReadme/t...
Provider=SQLOLEDB.1;Data Source=path
to database on server
Oracle
Provider=MSDAORA.1;Data Source=path to
database on server
Provider=MSIDXS.1;Data Source=path to
file
To provide for backward compatibility, the OLE DB Provider for ODBC supports ODBC connection
string syntax. The following table lists commonly used ODBC connection strings:
Microsoft Access
SQL Server
DRIVER={SQL Server};SERVER=path
to server
Oracle
Microsoft Excel
Microsoft Excel 97
Paradox
Text
Technical Support
This object is provided as is and is not supported through Wonderware Technical Support. A certain
level of testing has been completed to ensure the control operates in the manner described in the
manual, but as with any add-in control, no guarantees can be given as to how this object will
perform within a given application. It is suggested that you test your required functionality prior to
deploying the control in an application.
Created by: B. Martin
Updated by: Prerana Kulkarni
Tech Notes are published occasionally by Wonderware Technical Support. Publisher: Invensys Systems, Inc.,
26561 Rancho Parkway South, Lake Forest, CA 92630. There is also technical information on our software
products at Wonderware Technical Support.
. 14 14
22.09.2016 9:21