You are likely to use DataWindowSyntaxFromSql to create the syntax for most dynamic DataWindow objects. If you use DataWindowSyntaxFromSql, all you have to do is provide the SELECT statement and the presentation style.
DataWindowSyntaxFromSql is a method of the DataWindowSyntaxGenerator object and takes a Transaction or AdoTransaction object as a parameter. The transaction object must be connected when you call the method.
DatWindowSyntaxFromSql is overloaded. It has two required arguments:
A connected Transaction or AdoTransaction object
A string containing the SELECT statement for the DataWindow object
If you do not specify a third argument or the third argument is null, DataWindowSyntaxFromSql creates a DataWindow object with the Tabular presentation style. You can specify one of two third arguments:
A string identifying the presentation style and other settings. You can use the DWSyntax tool to generate this string—see “Tool for easier coding of DataWindow syntax”.
A value of the DataWindowStyle enumeration.
DataWindowSyntaxFromSql returns the complete syntax for a DataWindow object that is built using the specified SELECT statement.
If your DBMS is Adaptive Server and you call DataWindowSyntaxFromSql, the DataWindow server must determine whether the tables are updatable through a unique index. This is possible only if you set AutoCommit to true before calling DataWindowSyntaxFromSql, as shown here for a Transaction object called myTrans:
myTrans.AutoCommit=true DWSyntaxGenerator.DataWindowSyntaxFromSql (myTrans, sqlstmt, stylestr) myTrans.AutoCommit=false