3. Unit II
• Query Basics
• Computation Using Queries
• Subtotals and GROUP BY Command
• Queries with Multiple Tables
• Subqueries
• Joins
• DDL & DML
• Testing Queries
4. Unit III
• Effective Design of Forms and Reports –
• Form Layout –
• Creating Forms –
• Graphical Objects –
• Reports –
• Procedural Languages –
• Data on Forms –
• Programs to Retrieve and Save Data –
• Error Handling.
6. Effective Design of Forms
• Collect data
• Display query data
• Display analysis and
computation result
• Switch board
• Direct manipulation of
object like Graphics
• For organize the overall
system.
12. Graphical Objects
Methods Description
Print
Print is the simplest graphic method in Visual Basic 6. This method has been used
throughout the earlier versions of the language. It prints some text on the form or on
the PictureBox control. It displays texts.
Cls
The Cls method is another simple graphic method that is used to clear the surface of
the form or the PictureBox control. If some texts are present, you can use the Cls
method to remove the texts. It clears any drawing created by the graphic methods.
Point
The Point method returns the color value from an image for a pixel at a particular
point. This method is generally used to retrieve color values from bitmaps.
Refresh
The refresh method redraws a control or object. In other words, it refreshes the control.
Generally, controls are refreshed automatically most of the times. But in some cases,
you need to refresh a control’s appearance manually by explicitly invoking the Refresh
method.
PSet
The PSet method sets the color of a single pixel on the form. This method is used to
draw points.
Line
The Line method draws a line. Using the Line method, you can also draw other
geometric shapes such as rectangle, triangle etc.
Circle
The Circle method draws a circle. Using the Circle method, you can also draw other
geometric shapes such ellipses, arcs etc.
PaintPicture The PaintPicture method displays an image on the form at run-time.
TextHeight The TextHeight method returns the height of a string on the form at run-time.
TextWidth The TextWidth method returns the width of a string on the form at run-time.
13. • Design a form with appropriate triggers to
implement the main menu interface of your
application. The minimal functions provided
should be four buttons for Student,
Instructor/Faculty, Administration, Exit. Each of
the buttons should take the user to another form
or interface for an action like log in. Proper and
complete navigation from this main form with
appropriate alerts and messages to the next
interface completes this question.
14. Reports
• Reports are
important and
useful in many
respects because
they provide useful
and meaningful
information
concerning a set of
data. Figure 5.1 Types of Reports
15. Types of reports
• Tabular Report
• Master/Detail Report
• Form Letter
• Form Report
• Mailing Label
• Matrix Report
16. Report Design
Report
Header
Contains the text that appears at the very
beginning of a report, such as the report title,
author, or database name. If you want the
Report Header to be the first page in the report,
set its ForcePageBreak property to
rptPageBreakAfter.
Page Header Contains information that goes at the top of
every page, such as the report's title.
Group
Header/Foot
er
Contains a "repeating" section of the data report.
Each group header is matched with group
footer. The header and footer pair is associated
with a single Command object in the Data
Environment designer.
Details Contains the innermost "repeating" part (the
records) of the report. The details section is
associated with the lowest-level Command
object in a Data Environment hierarchy.
Page Footer Contains the information that goes at the bottom
of every page, such as the page no.
Report
Footer
Contains the text that appears at the very end of
the report, such as summary information, or an
address or contact name.
17. Forms vs Reports
Forms Reports
Forms are sometimes referred to as "data
entry screens."
Reports are used to summarize and present
data in the tables
Forms are intended more for simple/limited
data interaction
Reports are used to present, typically, larger
volumes of data.
Most database users prefer to use forms for
viewing, entering, and editing data in the
tables.
Each report can be formatted to present the
information in the most readable way possible
You can change the values of underlying data
with a form.
You cannot change the value of the
underlying data for a report with a control
object from the toolbox as you can with forms
Forms are a generic term for windows
used to interact with users. A form can
accept data from a user for data entry or
to provide input to a query. A form can
present data to a user, e.g. the results of a
query.
Reports are only used to extract and
present data for viewing and printing.
Forms provide datasheet view. Reports do not provide a Datasheet view.
Only Print Preview and Report Design
views are available.
18. • How do you bring a report up into the Report
Previewer using Reports Runtime
interactively? How can you accomplish the
same task from the command line?
• Which type of report is commonly used for
SQL*Plus output? What sort of report might
be used to display a select statement
containing a group by clause?
19. PL/SQL
• PL/SQL (Procedural Language /SQL) is a
technology and not an independent product.
Think of this technology as an engine that
executes PL/SQL statements. This engine can
be installed in an oracle server of in
application tool. It bridges the gap between
database technology and procedural
programming language.
20. Basic code structure
DECLARE
-- Declaration block (optional)
BEGIN
-- Program proper
EXCEPTION
-- Exception-handling (optional)
END
/* Sample comment spanning Multiple
lines... */
21. TRIGGER
• Advantages of Triggers:
– Applying Complex Business rules.
– Security.
– Auditing.
22. Program 1: Create a database Trigger corresponding to emp table which is
not going to allow the user to insert the employee’s salary more than 5000.
23. Error Handling
• There are number of
reasons due to which
run time errors may be
raised during the
execution of a PL/SQL
block. With PL/SQL, a
mechanism called
exception handling lets
you “bulletproof” your
program so that it can
continue operating in
the presence of errors.
Figure 6.1 Exception handling
24. Unit IV
• Power of Application Structure
• User Interface Features
• Transaction
• Forms Events
• Custom Reports
• Distributing Application
• Table Operations
• Data Storage Methods
• Storing Data Columns
• Data Clustering and Partitioning.
25. Power of Application Structure
Database applications in many different ways
• Standalone
• Shared file
• Shared database
• Web server applications
Figure 7.1 Standalone
Figure 7.2 Shared
27. Transaction
• Example (pseudo code):
BEGIN TRANSACTION; /*move $$$$ from account A to account B*/
UPDATE account A; /*Withdrawal*/
UPDATE account B; /* Deposit*/
IF everything worked fine
THEN COMMIT; /* Normal end*/
ELSE ROLLBACK; /*abnormal end*/
END IF;
28. Distributing Application
– Make the application stand alone
• Runs completely from your forms
• Never needs to use the database menu (tables, queries, forms,
reports)
• Automatically starts when the database is opened
– Tools| Database Utilities| Startup.
– AutoExec macro
– Application format
• Standard database format files
• Encrypted files
– Run-time package (developer’s edition)
– Security
– Installation package