Professional Documents
Culture Documents
wwGenericSQLGrid Manual
wwGenericSQLGrid Manual
wwGenericSQLGrid
All Tech Notes and KBC D documents and software are provided "as is" without warranty of any kind. See the Terms of Use for more
information.
Topic#: 001046
C reated: July 2002
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.
Unzip the installation files to a temporary directory. Locate the wwGenericSQLGrid.msi file. This package will be installed
using the Microsoft Installer feature of Windows. Once the file is located double-click on the .msi file.
3. Windows Installer will take you through the necessary steps to install wwGenericSQLGrid.
fa.sammicomputer.co.kr/TECH/html/t001046.htm 1/12
13/07/12 wwGenericSQLGrid
fa.sammicomputer.co.kr/TECH/html/t001046.htm 2/12
13/07/12 wwGenericSQLGrid
fa.sammicomputer.co.kr/TECH/html/t001046.htm 3/12
13/07/12 wwGenericSQLGrid
fa.sammicomputer.co.kr/TECH/html/t001046.htm 4/12
13/07/12 wwGenericSQLGrid
4. Scroll through the list of Available ActiveX controls and select wwGenericSQLGrid.Grid.
5. Click Install.
fa.sammicomputer.co.kr/TECH/html/t001046.htm 5/12
13/07/12 wwGenericSQLGrid
4. Click OK.
fa.sammicomputer.co.kr/TECH/html/t001046.htm 6/12
13/07/12 wwGenericSQLGrid
The Grid1 Properties dialog box opens:
The following table lists the available properties along with a description and data type.
Methods
ActiveX control methods are similar to ActiveX control properties. ActiveX control methods are accessed through ActiveX
Event scripts and/or InTouch QuickScripts.
fa.sammicomputer.co.kr/TECH/html/t001046.htm 7/12
13/07/12 wwGenericSQLGrid
3. Click ActiveX...
fa.sammicomputer.co.kr/TECH/html/t001046.htm 8/12
13/07/12 wwGenericSQLGrid
The following table describes the methods are available to use in a script.
Return
Method Name Description
Type
Select this method when changing connection
parameters. Note that this method also calls the
Connect() N/A execute method to verify the connection to the
database, you must set the SQLString property
before executing the connect.
Connect();
Select this method to connect to a data source
using an ADO connection string. See ADO
ConnectWithString N/A documentation for further information on
connection strings. The Examples section of this
Utility lists common examples.
ConnectWithString("INSERT CONNECTION STRING");
This method will clear the grid of it's current
Clear() N/A
contents, the recordset will still be available.
Clear();
Select this method when changing the SQLString
Execute() property. This will execute the query and return the
results to the grid.
Execute();
This method takes a row and column number and
GetRowColumnValue() String
returns the value of that cell.
StringTag = GetRowColumnValue(Row as int,
Column as int);
GetSelectedCellValue() String Returns an integer value of the selected row.
IntegerTag = GetRowNumber();
fa.sammicomputer.co.kr/TECH/html/t001046.htm 9/12
13/07/12 wwGenericSQLGrid
MoveLast() N/A Moves the selection to the last row in the grid.
MoveLast();
MovePrevious() N/A Moves the selection to the previous row in the grid.
MovePrevous();
Movenext() N/A Moves the selection to the next row in the grid.
Movenest();
About() N/A Displays the about box.
About();
Adds a string value to the SQLString property, this
SQLStringAppend() N/A method also pads a space at the beginning of the
added string.
SQLStringAppend("Where city = 'Boston'");
Disconnect() N/A Disconnects the current ADO connection.
Disconnect();
Events
Click - This event is triggered every time the user clicks on the area of the control.
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.
#Grid1.Server = Server;
#Grid1.Database = Database;
#Grid1.UserID = UserID;
#Grid1.Password = Password;
#Grid1.Connect();
Selection = #Grid1.GetSelectedCellValue();
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 able 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.
The name of the column is au_lname but the grid will display it as Last Name.
Connection strings can be used to connect to a variety of different data sources. To do this you would use the
ConnectWithString() method and pass the proper connection string. For more details on connection strings check ADO
documentation. The following are a few examples.
ODBC
fa.sammicomputer.co.kr/TECH/html/t001046.htm 10/12
13/07/12 wwGenericSQLGrid
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 common data sources:
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:
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 insure 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.
B. Martin
fa.sammicomputer.co.kr/TECH/html/t001046.htm 11/12
13/07/12 wwGenericSQLGrid
back to top
©2012 Invensys Systems, Inc. All rights reserved. No part of the material protected by this copyright may be reproduced or utilized in any
form or by any means, electronic or mechanical, including photocopying, recording, broadcasting, or by any information storage and retrieval
system, without permission in writing from Invensys Systems, Inc.
fa.sammicomputer.co.kr/TECH/html/t001046.htm 12/12