Oracle AppWizard for Microsoft Visual C++
Release 8.1.5 for Windows NT
A67160-01

Library

Product

Contents

Index

PrevNext

2
Creating a Starter Application

This chapter describes how to use Oracle AppWizard for Microsoft Visual C++ to create a starter application.

Topics include the following:

Overview

After starting Oracle AppWizard, you complete a series of steps in which you specify which of three application types you want to create, as shown in the table below.



Application Type Description

Single-Record Display Form 

Enables your application to display one record from one or more tables at a time. 

Multiple-Record Display Form 

Enables your application to display more than one record from one or more tables at a time. 

Master-Detail Display Form 

Enables yours application to display records from tables that have a master-detail relationship to each other. 

When you finish the last step, Oracle AppWizard for Microsoft Visual C++ generates the application. Application files include the following:

You then build and run the executable, using Microsoft Visual C++.

The first three steps are the same whether you create a single-record, multiple-record, or a master-detail display.
 


 
 

Starting Oracle AppWizard for Microsoft Visual C++

To start Oracle AppWizard for Microsoft Visual C++:

  1. Start Microsoft Visual C++ 5.0.

  2.  
  3. Choose File > New.

  4.   The New dialog box appears.
     
  5. Click the Projects tab.

  6.  
  7. Select Oracle AppWizard for MFC (exe) from the list of project types.

  8.  
  9. Specify the project name and location.

  10.  
  11. Click OK.

  12. Oracle AppWizard for Microsoft Visual C++ starts.

Creating a Single- or Multiple-Record Display Application

This section describes how to create a single- or multiple-record application.

Welcome Window

The Welcome window is the first window you see when you start Oracle AppWizard.

Click Next to continue.
 
 

Connecting to an Oracle Database

In the Connection window, you connect to an Oracle database.
 
 

To connect to the Oracle database:

  1. Type your user name in the User Name text box.

  2.  
  3. Type your password in the Password text box.

  4.  
  5. If connecting to a remote database, type the database alias in the Database Alias text box. If connecting to a local default database, leave the text box blank.

  6. For more information about database aliases, refer to the Oracle Net8 Administrator's Guide.
     
  7. Click Next.

Specifying the Type of Form

Use the Form Type window to generate a specific type of form, to give it a name of your choice, and to specify the database privileges for users.

Forms can be single-record, multiple-record, or master-detail display:

For example, if you select any or all database permissions for your users, Oracle AppWizard generates code for this purpose. This enables methods that allow the users of your application to update data. If you do not select any data usability options, Oracle AppWizard does not generate code for this purpose and the form will be read-only.
 
 

To complete the Form Type window:

  1. Type the name of the form. Each form name must be unique and the first character of the form name must be a letter. The rest of the form name must be alphanumeric.

  2. Example 2-1:
    a1b3eux
     

  3. If you want to create a single-record display form, select Single-Record Display Form.Or, if you want to create a multiple-record display form, select Multiple Record Display Form. 

  4.  

     

  5. If you want users to be able to add records, select the Add New Records checkbox.

  6.  
  7. If you want users to be able to change records, select the Change Existing Records checkbox.

  8.  
  9. If you want users to be able to delete records, select the Delete Existing Records checkbox.

  10.  
  11. Click Next.

Selecting Tables and Columns

In the Tables/Columns Selection window, you select columns from the tables you want the form to reference. The tables available to you appear in the list.
 
 

To complete Tables/Columns Selection window:

  1. Select one or more tables from the list to appear in your application. By default, all the columns of the table you select are also automatically selected unless you manually deselect them by clicking them.

  2.  
  3. The Update, Insert, and Delete options, specified in the Form Type window, work only with a single table. If you select multiple tables and have checked these options, the following error message appears:
  4. Add, Change, and Delete are supported in applications using a single table.
    You have selected multiple tables.
    Database Functionality defaults to Read Only.
    
  5. If necessary, expand the table you selected and select additional columns that should be displayed in the application.

  6.  
  7. Click Next.

Specifying One or More Joins (Optional)

Oracle AppWizard for Microsoft Visual C++ automatically creates a simple join (also called an equi-join) between two tables, or views, based on a Primary Key and a Foreign Key.

Such joins are used in the WHERE clause of a SELECT statement to avoid a Cartesian product, which would combine every row in one table with every row in an other table. For example, a 90-row table combined with a 100-row table would produce a 9000-row result.

Additional Information:

See the description of the SELECT command in Chapter 4 of Oracle SQL Reference for more information about various types of joins and Cartesian products. 





Tip:

When selecting tables or columns, use the Ctrl key and your mouse to select items that are not adjacent. Also, you can use the Ctrl key and your mouse to deselect an item. 


The Oracle AppWizard Table Join window displays a join in the following format for single or multiple tables:

SCHEMA.TABLE_NAME.COLUMN_NAME [DATA_TYPE] joins SCHEMA.TABLE_NAME.COLUMN_NAME 
   [DATA_TYPE]
If for some reason you do not want to use the suggested join created by Oracle AppWizard for Microsoft Visual C++ (shown in the previous illustration), you can delete it and create a new join. Alternatively, you can also do this by modifying the WHERE clause of a query statement in the source file generated by Oracle AppWizard.

To accept the default join:

To delete the default join:
  1. Highlight the default join displayed in the Table Joins list in the Table Join window.

  2.  
  3. Click the Delete Join button.

  4. Oracle AppWizard for Microsoft Visual C++ deletes the join.
To create a new a join:
  1. Highlight two columns from different tables that you want to join by using your mouse and the Ctrl key.

  2. The join appears in the Table joins list with the following syntax:
    SCHEMA.TABLE.COLUMN [DATA_TYPE] joins SCHEMA.TABLE.COLUMN [DATA_TYPE]


    Note:

    You can specify more than one join. 


  3. Click Next.

  4. Oracle AppWizard prompts you as to whether you want to build another form. If you decide to create a new form, you will not be able to go back and use AppWizard to modify the form you have already created. 
     
  5. If you want to build another form, click Yes and Oracle AppWizard will take you back to the Application Type window.

  6.  
  7. If you do not want to build another form, click No. 

  8. Note:

    If you only specify one table, Oracle AppWizard skips the table join step. 


Specifying the Application Type and User Language

When you are finished building forms and click Next, you are ready to specify the application type and the user language.
 

To complete the Application Type window:

  1. Indicate the type of application you are creating by clicking the appropriate option:

  2.  
 


Note:

Dialog-based applications are not supported in the current release. 


  1. In the list box, select the language appropriate for your application, or accept the default language.

  2.  
  3. Click Next.

  4.  

Completing the Remaining MFC Windows

Complete the remaining standard MFC windows as appropriate until you reach the window illustrated below. For more information about MFC windows, refer to your MSVC++ documentation.

Viewing the Application Classes

In the Class Information window, Oracle AppWizard for Microsoft Visual C++ displays the classes it will create for your application, including their names, header files, base classes, and the implementation file.
 

To complete the Class Information window:

  1. Review the list for completeness and accuracy:

  2.  

     

  3. If you are not satisfied with the listed classes, click Back to go to the appropriate previous dialog box to make changes.

  4.  

     

  5. Depending on which class you have selected, you may change the class name, header file name, and the implementation file name. If you rename these files, the first character must be a letter. The rest of the name must be alphanumeric.

  6.  

     

  7. When you are satisfied with the result, click Finish.

  8. The New Project Information window appears.

Viewing the Specifications for the New Application

The final window, New Project Information, displays the specifications for the new skeleton application you are creating.

  1. If the specifications appear to be correct, click OK.

  2. Oracle AppWizard generates the files for your single-record or multiple-record application.
     
     
  3. If the specifications are not correct, click Cancel.

Creating a Master-Detail Display Application

This section describes how to create an application that can display records from two or more tables that have a master-detail relationship.

The first three windows are completed in the same way as those described in "Creating a Single- or Multiple-Record Display Application," on, except that, for a master-detail display, you will complete the Application Type window as follows:

Specifying the Type of Form

In the Form Type window, type the name you want to give the form, select the type of form, and the database privileges that your application requires.


 

Selecting Master Tables and Columns

In the Master Table/Column Selection window, the master tables available to you appear in a list.

To complete the Master Table/Column Selection window:

  1. Select the master table columns from the list. In the example above, the Department table is the master table. All the columns from the Department table have been selected.

  2.  

     

  3. If necessary, expand the table you selected by clicking the '+' to the left of the table name and change which columns are to be displayed in the application.

  4.  

     

  5. Click Next.

  6.  

Selecting Detail Tables and Columns

In the Detail Table/Column Selection window, the detail tables that are available to you appear in a list. Select the detail tables and the columns that you want displayed in the application.

To complete the Detail Table/Column Selection window:

  1. Select columns from one or more detail tables in the list. In the illustration above, the Employee table is the detail table. The Employee table and all of its columns have been selected.

  2.  

     

  3. If necessary, expand the table you selected by clicking the '+' to the left of the table name, and change which columns are to be displayed in the application.

  4.  

     

  5. Click Next.

Building a Join Clause

After you have selected the tables between which you want to set up a master-detail relationship, you use the Master/Detail Table Join window to specify how to join the columns from each of the tables you selected in the last two windows.

Oracle AppWizard for Microsoft Visual C++ automatically creates a simple join (also called an equi-join) between two tables, or views, based on a Primary Key and a Foreign Key.

Such joins are used in the WHERE clause of a SELECT statement to avoid a Cartesian product, which would combine every row in one table with every row in an other table. For example, a 90-row table combined with a 100-row table would produce a 9000-row result.
 
 


 

If for some reason you do not want to use the default join created by Oracle AppWizard for Microsoft Visual C++ (shown in the previous illustration), you can delete it and create a new join. Alternatively, you can also do this by modifying the WHERE clause of a query statement in the source file generated by Oracle AppWizard.

If you want to create more than one join, choose one column from the master table and one column from the detail table to create each additional join clause.

To accept the default join in the Master/Detail Table Join window:

To delete the default join:

  1. Highlight the default join displayed in the Master and Detail Table Joins list in the Master/Detail Table Join window.

  2.  

     

  3. Click the Delete Join button.

  4. Oracle AppWizard for Microsoft Visual C++ deletes the join.

To create a new a join:

  1. Select one column from the master column list.

  2.  

     

  3. Select one column from the detail column list.

  4. The join appears in the Master and Detail Table Joins list with the following syntax:
    Master - SCHEMA.TABLE_NAME.COLUMN_NAME [DATA_TYPE] joins Detail - 
    SCHEMA.TABLE_NAME.COLUMN_NAME [DATA_TYPE]
     
    
  5. (To create multiple joins, repeat Steps 1 and 2.) If you want to delete a join from the Master and detail joins list, highlight it and click Delete Join. 

  6.  
  7. Click Next. Oracle AppWizard asks you whether or not you would like to build another form.

  8. If you want to build another form, click Yes, and Oracle AppWizard will take you back to the Form Type window.
    If you do not want to build another form, click No.

Specifying the Application Type and User Language

When you are finished building forms and click Next, you are ready to specify the application type and the user language.

To complete the Application Type window:

  1. Indicate the type of application you are creating by clicking the appropriate option:

  2.  


    Note:

    Dialog-based applications are not supported in the current release. 


  3. In the list box, select the language appropriate for your application, or accept the default language.

  4.  
  5. Click Next to proceed to the standard MFC windows.


 
 

Completing the Remaining MFC Windows

Complete the remaining standard MFC windows as appropriate until you reach the window illustrated below. For more information about MFC windows, refer to your MSVC++ documentation.


 
 

Viewing the Application Classes

In the Class Information window, Oracle AppWizard for Microsoft Visual C++ displays the classes it will create for your application, including their names, header files, base classes, and the implementation file.
 

To complete the Class Information window:

  1. Review the list for completeness and accuracy:

  2.  

     

  3. If you are not satisfied with the listed classes, click Back to go to the appropriate previous dialog box to make changes.

  4.  

     

  5. Depending on which class you have selected, you may change the class name, header file name, and the implementation file name. If you rename these files, the first character must be a letter. The rest of the name must be alphanumeric.

  6.  

     

  7. When you are satisfied with the result, click Finish.

  8. The New Project Information window appears.
     

Viewing the Specifications for the New Application

The final window, New Project Information, displays the specifications for the new skeleton application you are creating.


 

 

Building the Executable

After Oracle AppWizard generates the application, you can build an executable.


Note:

You may want to check the project settings to see if the they are correct for your configuration. Choose Settings from the Project menu to view the project settings. 


To build the executable:

Running the Executable

Now you are ready to execute the application you created.


Note:

By default, the active project configuration is the debug version. To change the active project configuration, choose Set Active Configuration from the Build menu. 


To run the executable:

  1. From the Build menu, choose Execute <executable name>.

  2. The Connect to Oracle dialog box appears.
     
     
  3. Type your User Name and Password.

  4. If connecting to a remote database, type its alias into the Database Alias text box.


 

After your application connects to the database successfully, the form you generated appears showing data retreived from the database. The following illustration is an sample of what your form might look like, although the appearance of your actual form and data will vary based on the database information you select.
 
 


 
 


Prev Next
Oracle
  Copyright © 1999 Oracle Corporation.
  All Rights Reserved.

Library

Product

Contents

Index