Setting Transaction object properties

Table 5-1 describes the properties of the Transaction object. You can set most of these properties in code or in the Properties window for a Transaction object in your .NET development environment. When you are designing a DataWindow object, you can set these properties in the Database profile dialog box in DataWindow Designer. The table lists the equivalent field in the Database Profile Setup dialog box that you complete to create a database profile in DataWindow Designer. A few of the properties cannot be set—you use them to get information about the transaction.

NoteProperties for DataWindow .NET database interfaces For information about the values you should supply for each connection property, see the section for the database interface you are using in the Connection Reference in the online Help for DataWindow Designer.

Table 5-1: Transaction object properties

Property

Datatype

Description

In a database profile

Dbms

Enumeration

The DBMS identifier for your connection. For a complete list of the identifiers for the supported database interfaces, see the online Help.

DBMS

Database

String

The name of the database to which you are connecting.

Database Name

UserID

String

The name or ID of the user who will log in to the database server.

User ID

Password

String

The password used to log in to the database server.

Password

Lock

String

For those DBMSs that support the use of lock values and isolation levels, the isolation level to use when you connect to the database. For information about the lock values you can set for your DBMS, see the descriptions of the Isolation and Lock database parameters in the online Help for DataWindow Designer.

Isolation or Isolation Level

ServerName

String

The name of the server on which the database resides.

Server Name

AutoCommit

Boolean

For those DBMSs that support it, specifies whether database operations are issued outside of the scope of a transaction, and therefore take immediate and permanent effect.

AutoCommit Mode

DbParameter

String

Contains DBMS-specific connection parameters that support particular DBMS features. For a description of each parameter that the DataWindow server supports, see the chapter on setting additional connection parameters in Connecting to Your Database.

Various fields

SqlReturnData

String

Contains DBMS-specific information.

Cannot be set

RowsAffected

Int32

The number of rows affected by the most recent SQL operation. The database vendor supplies this number, so the meaning may be different for each DBMS.

Cannot be set

DbHandle

String

The handle for your DBMS, which can be used to directly involve native methods in the database client API.

Cannot be set

IsConnected

Boolean

Whether the transaction object is connected to the database. Values are true (connected) and false (not connected).

Cannot be set

Using the Preview tab to connect in DataWindow Designer

The Preview tab page in the Database Profile Setup dialog box makes it easy to generate accurate connection syntax in DataWindow Designer for use in your .NET code.

As you complete the Database Profile Setup dialog box, the correct connection syntax for each selected option is generated on the Preview tab. DataWindow Designer assigns the corresponding database parameter or property name to each option and inserts quotation marks, commas, semicolons, and other characters where needed. You can copy the syntax you want from the Preview tab directly into your script.

StepsTo use the Preview tab to connect in a .NET application:

  1. In the Database Profile Setup dialog box for your connection, supply values for basic options on the Connection page and additional parameters and properties on the other tabbed pages as required by your database interface.

    For information about connection parameters for your interface and the values you should supply, click the Help button in the dialog box.

  2. Click Apply to save your settings without closing the Database Profile Setup dialog box.

  3. Click the Preview tab.

    The correct connection syntax for each selected option displays in the Database Connection Syntax box using SQLCA as the name of the Transaction object and VB.NET as the language.

  4. If necessary, change the name in the Transaction Object box and select a different language from the Language Option list.

  5. Select one or more lines of text in the Database Connection Syntax box and click Copy.

    DataWindow Designer copies the selected text to the clipboard. You can then paste this syntax into your code.

  6. Click OK.

Example

The following statements assign values to the properties of a Transaction object named TR1 so that it can connect to the EAS Demo database using an ODBC connection:

[Visual Basic]
TR1.Dbms = DbmsType.Odbc
TR1.AutoCommit = True
TR1.DbParameter = "ConnectString='DSN=EAS Demo DB V105 DWD;UID=dba;PWD=sql',RPCReBind=1,DisableBind=1,
PBUseProcOwner='Yes'"

[C#]
TR1.Dbms = DbmsType.Odbc;
TR1.AutoCommit = true;
TR1.DbParameter = "ConnectString='DSN=EAS Demo DB V105 DWD;UID=dba;PWD=sql',RPCReBind=1,DisableBind=1,
PBUseProcOwner='Yes'";