Using an AdoTransaction object

You can use an AdoTransaction object to share an ADO.NET connection with other database constructs in your application, such as Command objects, DataSets, DataTables, and DataViews.

NoteDrag-and-drop not available In Visual Studio, you can create a Transaction object by dragging the Transaction item from the Sybase DataWindow tab in the Toolbox to a form. You cannot create an AdoTransaction object using drag-and-drop—you must create it in code.

The ADO.NET database interface provided with DataWindow .NET comprises a server in a private .NET assembly (Sybase.DataWindow.Db.dll or Sybase.DataWindow.DbExt.dll for Oracle 10g or Adaptive Server® Enterprise 15 or later) and an unmanaged driver library (PBADO110.DLL). When you deploy an application that uses an AdoTransaction object, you must deploy these DLLs as well as PBSHR110.DLL. For more information about deploying applications, see Chapter 13, “Deploying DataWindow .NET Applications.”

PBSHR110.DLL contains utility routines that constitute a database interface layer between the DataWindow server and DataWindow .NET database interfaces for OLEDB, ODBC, and specific DBMSs, as well as ADO.NET. You must deploy this file with all DataWindow .NET applications, whatever database connectivity options they use.

For more information about the ADO.NET database interface, see Connecting to Your Database.

When you connect to a database in ADO.NET, you use one of the data providers supplied with the .NET Framework. Each data provider has four primary objects:

In DataWindow .NET, you interact with the Connection object to open a connection to a database. In this release, you do not work directly with the other objects—the DataWindow handles database operations.

The AdoTransaction object has some similarities to the data provider’s Command object. Both have properties that get and set the connection and transaction that they use to perform database operations, and the AdoTransaction object creates a Command object internally and passes connection and transaction information to it.

NoteData provider support In this release, the .NET Framework data providers for OLE DB and SQL Server are supported.

Overview of steps

If you are using an AdoTransaction object to connect to a database, you take the following general steps:

  1. Create a new instance of an ADO.NET Connection object and set its properties.

  2. Open an existing connection or create a new one.

  3. Create an AdoTransaction object that uses the Connection object and bind it to the internal database interaction layer.

  4. Assign the AdoTransaction object to a DataWindowControl, WebDataWindowControl, or DataStore.

  5. Start a transaction and perform database processing.

  6. Disconnect from the database.

NoteGenerating code in the Database Profile dialog box You can use the Database Profile dialog box for ADO.NET in DataWindow Designer to generate the code you need to perform the first three of these steps. See “Using the Preview tab to connect in DataWindow Designer”.