dotConnect for Oracle Documentation
In This Topic
    Using DataSet Editor
    In This Topic
    This topic is applicable only for full .NET Framework.

    General Information

    dotConnect for Oracle supports working with both strongly typed and untyped DataSets. The DataSet Editor is a tool that allows you to create a strongly typed DataSet visually. This tutorial shows how to set the DataSet schema with the editor manually. For information about typed DataSet generation with the help of wizard, see tutorial Using DataSet Wizard.

    This walkthrough supposes that you know how to establish the connection to the Oracle server (see Logging onto the Server) and how to use Devart configuration window for data tables and commands.

    Creating typed DataSet

    In this tutorial, we will create a strongly typed DataSet from an untyped one. It will include tables Dept and Emp; for their definitions, see the tables.sql script which is located in the dotConnect for Oracle installation directory. The following steps need to be performed:

    1. Create an untyped DataSet OracleDataSet1. To do this, you may either drop an OracleDataSet object to the form or double-click it in the toolbox. Select the Untyped OracleDataSet option and click OK:

      Add OracleDataSet dialog box

      Double-click new DataSet or select the Edit item from the pop-up menu to start DataSet Editor.

    2. Create a data table. Use the Add new table to DataSet button to create a new data table. Rename the table to "Dept" with the corresponding item of the pop-up menu.

    3. Configure data table. Set up DataTable select and update commands. Double-click the table or select the Configure Data Table item from the pop-up menu. DataTable Editor window will appear:

      Choosing tables

      For detailed information about DataTable Editor using, see the Working with Command Editor topic.

    4. Generate data table schema. Populate the Columns collection of the data table by clicking the Create Columns item from the table item pop-up menu:

      Creating columns

      Otherwise, you will be prompted to create table columns during the DataSet schema saving.

    5. Configure additional data tables. Repeat steps 2-4 to add other data tables (the only Emp table in our case):

      Setting up emp table

      Note:To remove redundant data tables from your DataSet, use the Remove table from the DataSet button.

    6. Create associations. Use the Edit DataSet relations button to set up associations between your tables. Add and edit relations in the relation editor:

      Creating relations
    7. Save DataSet Schema. Use the Save Schema button to save your DataSet. Set the schema name to NewDataSet. After schema saving the NewDataSet class is generated. It will be available in the toolbox and can be used for other typed DataSets creation with the same schema. OracleDataSet1 object becomes an instance of typed NewDataSet and cannot be changed by the editor anymore:

      DataSet Editor

    Using created DataSet

    The OracleDataSet1 object can be used as common typed DataSet now. For example, the following code will

    1. fill the OracleDataSet1 object;
    2. insert a new record into the Dept table;
    3. delete the row with Empno = 20 from the Emp table.
    myDataSet1.Fill();
    myDataSet1.Dept.AddDeptRow(50, "IT", "San-Francisco");
    myDataSet1.Emp.RemoveEmpRow(myDataSet1.Emp.FindByEMPNO(20));
    
    
    myDataSet1.Fill()
    myDataSet1.Dept.AddDeptRow(50, "IT", "San-Francisco")
    myDataSet1.Emp.RemoveEmpRow(myDataSet1.Emp.FindByEMPNO(20))
    
    

    See Also

    Working with Command Editor  | Using DataSet Wizard  | Logging Onto The Server