Adding a Transaction object to the form

You can use either a Transaction object or an AdoTransaction object to connect to a database. An AdoTransaction object lets you share a connection with other database constructs in an application. For this simple application, you will use a Transaction object, which is used exclusively for DataWindow .NET controls.

NoteDrag-and-drop not available for AdoTransaction You can add a Transaction object to a form using drag-and-drop, but an AdoTransaction object can only be added in code. For more information, see “Using an AdoTransaction object”.

StepsTo add a Transaction object to a form:

  1. Drag the Transaction item from the Sybase DataWindow tab of the Toolbox to the form.

    Since the Transaction object is nonvisual, it displays below the form.

  2. Right-click the Transaction object to display its Properties window.

  3. Change the Name property to myTrans.

  4. Type the following in the DbParameter field:

     ConnectString='DSN=EAS Demo DB V105 DWD;UID=;PWD='
    
  5. Make sure the EAS Demo database is running, then click the Test Connection link in the properties window.

    You should see a message box indicating that the connection was successful.

    NoteTroubleshooting tip If the connection was not successful, go back to DataWindow Designer and look at the Preview page of the Database Profile dialog box. Change the language to whatever language you are using, change the name of the Transaction object to myTrans, and make sure that the generated code in Visual Studio .NET matches the generated code in the Database Connection Syntax pane.