4 Using the Data Providers in Visual Studio : Using the DataDirect Wizards

Using the DataDirect Wizards
Wizards simplify typical tasks that you perform when you create an application:
Before beginning this procedure, create a project using a DataDirect Connect template, as described in “Creating a New Project”, and add a data connection.
Creating Tables With the Add Table Wizard
You can quickly and easily define new tables in Visual Studio using the Progress DataDirect Connect for ADO.NET Add Table Wizard.
To create tables with the Add Table Wizard:
1
Select View / Server Explorer.
2
3
Right-click the Tables node, and select Add New Table. The Progress DataDirect Connect for ADO.NET Add Table Wizard appears.
4
Click Next. The Specify Table Name dialog box appears.
Specify Table Name dialog
5
In the Table Schema drop-down list, select a table schema.
In the Table Name field, type a name for the table.
6
Click Next. The Specify Column(s) dialog box appears.
Specify Column(s) dialog
7
a
Click Add to add a column to the table. The Column Name and Data Type fields become editable.
b
c
d
e
8
Click Next. The Specify Primary Key dialog box appears. Take one of the following actions:
If you do not want to specify a primary key for the table, select No Primary Key, and then click Next. The Specify Unique Key(s) dialog box appears. Continue at Step 11.
9
Specify Primary Key dialog
10
Click Next. The Specify Unique Key(s) dialog box appears.
Specify Unique Key(s) dialog
11
If you do not want to specify unique keys for the table, click Next. The Specify Foreign Key(s) dialog box appears. Continue at Step 14.
12
Click Add. The fields on the dialog box become selectable:
In the Unique Keys drop-down list, select a unique key.
In the Unique Key Name field, edit the name or accept the default name.
In the Available Columns list box, select one or more columns to be used to specify the unique key, and click the arrow to move them to the Selected Columns list box.
13
Click Next. The Specify Foreign Key(s) dialog box appears.
Specify Foreign Key(s)
14
If you do not want to specify foreign keys for the table, click Next. The Review SQL dialog box appears. Continue at Step 17.
15
Click Add. The fields on the dialog box become selectable:
In the Foreign Keys drop-down list, select a foreign key.
In the Foreign Key Name field, edit the name or accept the default name.
In the Table Schema drop-down list, select a table schema.
In the Table Name drop-down list, select a table schema.
In the Foreign Key Column drop-down list, select one or more columns to be used to specify the foreign key.
In the Parent Table Column drop-down list, select the corresponding column from the parent table.
16
Click Next. The Review SQL dialog box appears.
Review SQL dialog
17
If you are satisfied with the SQL statement, click Finish. The table that you created appears in Server Explorer under the Tables node for the connection.
18
Select the Edit SQL check box. The text in the Generated SQL field becomes editable.
NOTE: When you select the Edit SQL check box, the Back button is disabled.
19
When you are satisfied with your changes to the SQL statement, click Finish. The table that you created appears in Server Explorer under the Tables node for the connection.
Creating Views with the Add View Wizard
You can quickly and easily define new views in Visual Studio using the Progress DataDirect Connect for ADO.NET Add View Wizard.
To add views with the Add View wizard:
1
Select View / Server Explorer.
2
3
Right-click the Views node, and select Add New View. The Progress DataDirect Connect for ADO.NET Add View Wizard welcome dialog box appears.
4
Click Next. The Specify View Name dialog box appears.
Specify View Name dialog box
5
6
Click Next. The Select Table(s) and/or Column(s) dialog box appears.
Select Table(s) and/or Column(s)
7
In the List of Tables and columns list box, select the tables or columns that will make up the view, and click the arrow to move them to the Selected Columns column.
8
Click Next. The Review SQL dialog box appears.
Review SQL dialog for the Add View Wizard
9
If you are satisfied with the SQL statement, click Finish. The view that you created appears in Server Explorer under the Views node for the connection.
10
Select the Edit SQL check box. The text in the Generated SQL field becomes editable.
NOTE: When you select the Edit SQL check box, the Back button is disabled.
11
When you are satisfied with your changes to the SQL statement, click Finish. The view that you created appears in Server Explorer under the Views node for the connection.