You are on page 1of 18

RDBMS PROGRAMMING IN FOXPRO

1. A database is an organized collection of data, generally stored and accessed


electronically from a computer system. Where databases are more complex they are
often developed using formal design and modeling techniques
2. A File Management Utility is a computer program that provides a user with a graphical
interface in which he/she can organize filesand folders on a computer's storage device
3. Fox pro pdf page 8
4. In general, indexing refers to the organization of data according to a specific schema or
plan. In IT, the term has various similar uses including, among other things, making
information more presentable and accessible.
5. Fox pro pdf page 14

6. A macro is an automated input sequence that imitates keystrokes or mouse actions.


A macro is typically used to replace a repetitive series of keyboard and mouse actions
and are common in spreadsheet and word processing applications like MS Excel and
MS Word. The file extension of amacro is commonly
7. FoxPro was a text-based procedurally oriented programming language and database
management system (DBMS), and it is also an object-oriented programming language,
originally published by Fox Software and later by Microsoft, for MS-DOS, Windows,
Macintosh, and UNIX.
8. Book page 7
9. Fox pro pdf page 34
10. Book page no. 50

11. A user-defined function (UDF) is a common fixture in programming languages,


and the main tool of programmers for creating applications with reusable code. Since
programs are mostly composed of code that comes from the programmer, or in this case
the user, most of it is composed of user-defined functions occasionally punctuated by
built-in functions

12. Debugging is the routine process of locating and removing computer program
bugs, errors or abnormalities, which is methodically handled by software
programmers via debugging tools. Debugging checks, detects and corrects
errors or bugs to allow proper program operation according to set specifications.
Debugging is also known as debug.
13. What is memory variable in
foxpro?
The same as in other programming languages. A place to
store a value. A variable may be of different types,
including logical, string, numeric, or date.

Here is an example that uses a variable:

x=5

? "The square root of", x, " is ", sqrt(x).

In FoxPro, it isn't necessary to declare variables. It is


safer, though, in order to avoid conflicts between
different modules, to declare the variable (usually with
the LOCAL keyword if you use Visual FoxPro, or PRIVATE
if you use the old FoxPro 1.x or 2.x).

All variables are of a type which in some languages is


called "variant", that is, the type can change at runtime.

14. Book page no 87


15. Every computer requires appropriate instruction set (programs) to perform the required task. The
quality of the processing depends upon the given instructions. If the instructions are improper or
incorrect, then it is obvious that the result will be superfluous.
Therefore, proper and correct instructions should be provided to the computer so that it can provide the
desired output. Hence, a program should be developed in such a way that it ensures proper functionality
of the computer. In addition, a program should be written in such a manner that it is easier to understand
the underlying logic.
A good computer program should have following characteristics:
 Portability: Portability refers to the ability of an application to run on different platforms
(operating systems) with or without minimal changes. Due to rapid development in the hardware and the
software, nowadays platform change is a common phenomenon. Hence, if a program is developed for a
particular platform, then the life span of the program is severely affected.
 Readability: The program should be written in such a way that it makes other programmers or
users to follow the logic of the program without much effort. If a program is written structurally, it helps
the programmers to understand their own program in a better way. Even if some computational efficiency
needs to be sacrificed for better readability, it is advisable to use a more user-friendly approach, unless
the processing of an application is of utmost importance.
 Efficiency: Every program requires certain processing time and memory to process the
instructions and data. As the processing power and memory are the most precious resources of a
computer, a program should be laid out in such a manner that it utilizes the least amount of memory and
processing time.
 Structural: To develop a program, the task must be broken down into a number of subtasks.
These subtasks are developed independently, and each subtask is able to perform the assigned job
without the help of any other subtask. If a program is developed structurally, it becomes more readable,
and the testing and documentation process also gets easier.
 Flexibility: A program should be flexible enough to handle most of the changes without having
to rewrite the entire program. Most of the programs are developed for a certain period and they require
modifications from time to time. For example, in case of payroll management, as the time progresses,
some employees may leave the company while some others may join. Hence, the payroll application
should be flexible enough to incorporate all the changes without having to reconstruct the entire
application.
 Generality: Apart from flexibility, the program should also be general. Generality means that if a
program is developed for a particular task, then it should also be used for all similar tasks of the same
domain. For example, if a program is developed for a particular organization, then it should suit all the
other similar organizations.
 Documentation: Documentation is one of the most important components of an application
development. Even if a program is developed following the best programming practices, it will be
rendered useless if the end user is not able to fully utilize the functionality of the application. A well-
documented application is also useful for other programmers because even in the absence of the author,
they can understand it.

16. What Is Rushmore 

Rushmore is a data access technique that permits sets of records to be accessed very efficiently. Rushmore
query optimization uses indexes efficiently to quickly find a set of records. It is used on queries that involve
restrictions on multiple-indexed fields. Rushmore is an exclusive technology for rapidly selecting sets of
records from tables. It can reduce query response times from hours or minutes to seconds. 

The legendary data access performance in FoxPro stems from its Rushmore query optimization and use of
fixed length storage of data. Rushmore creates bit-mapped indexes that allow the engine to very quickly
determine whether each row in a table meets a criteria and should therefore be included in a query's result
set. Fixed width storage of data ensures that a field will be in the same location from row to row, making that
field easier to locate. 

Starting with the Rushmore query technology in the Visual FoxPro 2.0 release, FoxPro's primary attraction
has been its fast data engine. It doesn't seem to have lost that edge over the years: posted reports on the
newsgroups claim the new release of Visual FoxPro is twice as fast as SQL Server, for 50 users or less
Understanding Rushmore Technology 

Rushmore technology is a data access technique that uses standard Visual FoxPro indexes to optimize
access to data. You can use Rushmore with any Visual FoxPro index, including FoxPro 1.x (.idx) indexes,
compact (.idx) indexes, and compound (.cdx) indexes. 

Both .cdx and compact .idx indexes use a compression technique that produces indexes as small as one-
sixth the size of uncompressed old-format indexes. Visual FoxPro can process a compressed index faster
because it requires less disk access, and because more of the index can be buffered in memory. Although
Rushmore, like other file access techniques, benefits from the smaller size of compact indexes, it also
functions very well with indexes in older formats. 

When Visual FoxPro processes very large tables on computers with only the minimum amount of RAM,
Rushmore might not find sufficient memory to operate. In that case, Visual FoxPro might display a warning
message (“Not enough memory for optimization”). Although your program will function correctly and without
losing any data, the query will not benefit from Rushmore optimization. 

In its simplest form, Rushmore speeds the performance of single-table commands using FOR clauses that
specify sets of records in terms of existing indexes. Also, Rushmore can speed the operation of certain
commands such as LOCATE and INDEX. 

Visual FoxPro SQL commands use Rushmore as a basic tool in multi-table query optimization, using
existing indexes and even creating new ad-hoc indexes to speed queries. . 

17. Not
18. Structured Query Language (SQL) is a standard computer language for relational
database management and data manipulation. SQL is used to query, insert, update and
modify data. Most relational databases support SQL, which is an added benefit for
database administrators (DBAs), as they are often required to support databases across
several different platforms.

These SQL commands are mainly categorized into four categories as discussed below:
1. DDL(Data Definition Language) : DDL or Data Definition Language actually consists of
the SQL commands that can be used to define the database schema. It simply deals with
descriptions of the database schema and is used to create and modify the structure of
database objects in database.
Examples of DDL commands:
 CREATE – is used to create the database or its objects (like table, index,
function, views, store procedure and triggers).
 DROP – is used to delete objects from the database.
 ALTER-is used to alter the structure of the database.
 TRUNCATE–is used to remove all records from a table, including all spaces
allocated for the records are removed.
 COMMENT –is used to add comments to the data dictionary.
 RENAME –is used to rename an object existing in the database.
2. DML(Data Manipulation Language) : The SQL commands that deals with the
manipulation of data present in database belong to DML or Data Manipulation Language
and this includes most of the SQL statements.
Examples of DML:
 SELECT – is used to retrieve data from the a database.
 INSERT – is used to insert data into a table.
 UPDATE – is used to update existing data within a table.
 DELETE – is used to delete records from a database table.
19. Flowcharts are used in designing and documenting simple processes or programs. Like
other types of diagrams, they help visualize what is going on and thereby help understand a
process, and perhaps also find less-obvious features within the process, like flaws
and bottlenecks. There are different types of flowcharts: each type has its own set of boxes
and notations. The two most common types of boxes in a flowchart are:

 a processing step, usually called activity, and denoted as a rectangular box.


 a decision, usually denoted as a diamond.
What are the Basic Symbols of
a Flowchart?
Let's go over each flowchart symbol individually.

Start/End Symbol
The terminator symbol marks the starting or ending point of the system. It usually
contains the word "Start" or "End."

Action or Process Symbol


A box can represent a single step ("add two cups of flour"), or and entire sub-
process ("make bread") within a larger process.

Document Symbol
A printed document or report.

Multiple Documents Symbol


Represents multiple documents in the process.
Decision Symbol
A decision or branching point. Lines representing different decisions emerge from
different points of the diamond.

Input/Output Symbol
Represents material or information entering or leaving the system, such as
customer order (input) or a product (output).

Manual Input Symbol


Represents a step where a user is prompted to enter information manually.

Preparation Symbol
Represents a set-up to another step in the process.

Connector Symbol
Indicates that the flow continues where a matching symbol (containing the same
letter) has been placed.
Or Symbol
Indicates that the process flow continues in more than two branches.

Summoning Junction Symbol


Indicates a point in the flowchart where multiple branches converge back into a
single process.

Merge Symbol
Indicates a step where two or more sub-lists or sub-processes become one.

Collate Symbol
Indicates a step that orders information into a standard format.
Sort Symbol
Indicates a step that organizes a list of items into a sequence or sets based on
some pre-determined criteria.

Subroutine Symbol
Indicates a sequence of actions that perform a specific task embedded within a
larger process. This sequence of actions could be described in more detail on a
separate flowchart.

Manual Loop Symbol


Indicates a sequence of commands that will continue to repeat until stopped
manually.

Loop Limit Symbol


Indicates the point at which a loop should stop.

Delay Symbol
Indicates a delay in the process.
Data Storage or Stored Data Symbol
Indicates a step where data gets stored.

Database Symbol
Indicates a list of information with a standard structure that allows for searching
and sorting.

Internal Storage Symbol


Indicates that information was stored in memory during a program, used in
software design flowcharts.

Display Symbol
Indicates a step that displays information.
Off Page
Indicates that the process continues off page.

20. not

21. book page 8. Creating Reports Using Wizards


You can create reports easily by using a report wizard. The report
wizards help you set up and create a report layout using your
answers to a series of questions. You can use the Report Wizard to
create reports with single tables, for example, to create a list of
names and addresses from a customer table. You can use the One-
To-Many Report Wizard to create reports with tables that have a
parent-child relationship, for example, to create a list of orders for a
customer from a customer table and an orders table.
To start a report wizard
1. Open the project for your application.
2. In the Project Manager, expand the Documents node.
3. In the Documents node, click Reports and then New.
4. In the New Report dialog box, click Report Wizard.
5. Select the type of report you want to create.
6. Follow the instructions on the wizard screens.

For more information, see Report Wizard and One-To-Many Report


Wizard.

You can also start wizards from the Tools menu by clicking Wizards
and selecting a wizard. After you create a layout using a wizard, you
customize the layout using the Report Designer.
Creating Reports Using Quick Report
You can create reports quickly by using Quick Report, which creates
a simple report from a single table.
Tip:

You can use Quick Report in existing report files if the Detail band is empty. If the Page Header band
contains controls, Quick Report saves them.

Note:

Quick Report does not add General fields to the report layout.

To create a quick report


1. Open the project for your application.
2. In the Project Manager, expand the Documents node.
3. In the Documents node, click Reports and then New.
4. In the New Report dialog box, click New Report.

The Report Designer opens.

5. On the Report menu, click Quick Report.


6. In the Open dialog box, browse to the directory containing the
table you want and select the table.
7. In the Quick Report dialog box, click the field layout you
want.
8. To select specific fields to include, click Fields. When you are
finished selecting fields, click OK.
Note:

By default, all fields except General fields in the table are included.

9. Select or clear the Title, Add alias, or Add table to data


environment settings.
10. When you are finished in the Quick Report dialog box,
click OK.

For more information, see Quick Report Dialog Box.

You can also start a quick report from the File menu by clicking New
and in the New dialog box, click Report and then New File. The
Report Designer appears. To continue, follow the remaining steps
described for creating a quick report.

You can create a quick report programmatically without opening the


Report Designer by using the Quick Report version of the CREATE
REPORT command. For more information, see CREATE REPORT -
Quick Report Command.

Creating Reports Using the Report Designer


You can create custom reports by starting with a blank report layout
in the Report Designer.
Note:

The Report Designer and Label Designer are similar in functionality but differ in the default page and
paper they use.

To start the Report Designer


1. Open the project for your application.
2. In the Project Manager, expand the Documents node.
3. In the Documents node, click Reports and then New.
4. In the New Report dialog box, click New Report.

The Report Designer opens

22. Not
23. Arithmetic Operations and Functions

Operations

In FORTRAN, addition and subtraction are denoted by the usual plus (+) and minus
(-) signs. Multiplication is denoted by an asterisk (*). This symbol must be used to
denote every multiplication; thus to multiply N by 2, we must use 2 * N or N *
2 not 2N. Division is denoted by a slash (/), and exponentiation is denoted by a pair of
asterisks (**).

Operator Operation

+ addition, unary plus

- subtraction, unary minus


* multiplication

/ division

** exponentiation

Real Arithmetic

Providing all variables and constants in the expression are real, real arithmetic will be
carried out as expected, with no decimal places being truncated.

Integer Arithmetic

Providing the expression has all integers, subtraction, addition, multiplication and
exponentiation will prove no problem. However integer division is somewhat
different than normal division with real values. Integer division ignores the fractional
part. Any decimal places are truncated.

Example

5 / 2 gives the result 2 instead of 2.5


3 / 4 gives the result 0 instead of 0.75

Mixed Mode Arithmetic

Mixed mode arithmetic is when an expression contains both reals and integers. If
ANY of the operands are real then result of the operation will be real. However,
mixed mode arithmetic should be used with extreme care. You may think you have a
real operand when in reality you have two integer operands.

Example

5/2*
is 6.0 Incorrect because the order of operation is left to right. 5/2 = 2 then 2 * 3.0 = 6.0
3.0

3.0 * 5 / is 7.5 Correct because of mixed mode arithmetic 3.0 * 5 = 15.0 then 15.0/2 = 7.5(TAKWE
2 EXAMPLE FROM BOOK PAGE NO.107)

This step-by-step article describes how to use Mathematical functions, Type Conversion
functions, and String functions that are defined in Visual Basic .NET or Visual Basic 2005.
back to the top

Use Math Functions

The functions that are used for mathematical calculations are defined in
the System.Math class. The Mathclass includes trigonometric functions, logarithmic
functions, and other common mathematical functions. The following functions are the
functions that are defined in the Math class of the System namespace.

Note To use these functions, import the System.Math namespace to your project by adding
the following code to the top of the source code:

Imports System.Math
Abs 

The Abs function returns the absolute value of the specified number.

Abs example:

This example uses the Abs method of the Math class to compute the absolute value of a


number.

' Code will not compile unless it is put in a Sub or in a Function.


Dim MyNumber As Double
MyNumber = Abs(50.3) ' Returns 50.3.
MyNumber = Abs(-50.3) ' Returns 50.3.
Atan

The Atan function returns a Double value that contains the angle. The tangent of the angle
is the specified number. A positive return value represents a counter-clockwise angle from
the x-axis. A negative return value represents a clockwise angle. Multiply the return value by
180 divided by pi (π) to convert from radians to degrees.

Atan example:

This example uses the Atan method of the Math class to calculate the value of pi.


' Code is not compiled unless it is put in a Sub or in a Function.
Dim pi As Double
pi = 4 * Atan(1) ' Calculate the value of pi.
Cos

The Cos function takes an angle in radians as an argument and then returns a Double value
that is the cosine of the specified angle.

Cos example:

This example uses the Cos method of the Math class to return the cosine of an angle.

' Code is not compiled unless it is put in a Sub or in a Function.


Dim MyAngle, MySecant As Double
MyAngle = 1.3 ' Define angle in radians.
MySecant = 1 / Cos(MyAngle) ' Calculate secant.
Exp

The Exp function returns a Double value that contains e (the base of natural logarithms)


raised to the specified power. Use the Pow method to calculate powers of other
bases. Exp is the inverse of Log. 

Exp example:

This example uses the Exp method of the Math class to return e raised to a power.

' Code is not compiled unless it is put in a Sub or in a Function.


Dim MyAngle, MyHSin As Double
' Define angle in radians.
MyAngle = 1.3
' Calculate hyperbolic sine.
MyHSin = (Exp(MyAngle) - Exp(-1 * MyAngle)) / 2
Log

The Log function returns a Double value that contains the logarithm of a specified number.
This method is overloaded and can return either the natural (base e) logarithm of a specified
number or the logarithm of a specified number in a specified base.

Log example:
This example uses the Log method of the Math class to return the natural logarithm of a
number.

' Code is not compiled unless it is put in a Sub or in a Function.


Dim MyAngle, MyLog As Double
' Define angle in radians.
MyAngle = 1.3
' Calculate inverse hyperbolic sine.
MyLog = Log(MyAngle + Sqrt(MyAngle * MyAngle + 1))
Round 

The Round function returns a Double value that contains the number that is nearest the
specified value. Additional Round functions are available as methods of the intrinsic types
such as the Decimal.Roundmethod.

Round example:

This example uses the Round method of the Math class to round a number to the nearest


integer.

' Code is not compiled unless it is put in a Sub or in a Function.


Dim MyVar1 As Double = 2.8
Dim MyVar2 As Double
MyVar2 =Round(MyVar1) ' Returns 3.
Sign 

The Sign function returns an integer value that indicates the sign of a number. The following
table shows the input arguments of the function and of the return values:

Specified Number Return Value

Positive 1

Negative -1

Zero 0

Sign example:
This example uses the Sign method of the
Math class to determine the sign of a number.

' Code is not compiled unless it is put in a Sub or in a Function.


Dim MyVar1, MyVar2, MyVar3 As Double
Dim MySign As Integer
MyVar1 = 12
MyVar2 = -2.4
MyVar3 = 0
MySign = Sign(MyVar1) ' Returns 1.
MySign = Sign(MyVar2) ' Returns -1.
MySign = Sign(MyVar3) ' Returns 0.
Sin 

The Sin function takes an angle in radians as an argument and then returns a Double value
that specifies the sine of the angle.

Sin example:

This example uses the Sin method of the Math class to return the sine of an angle.

' Code is not compiled unless it is put in a Sub or in a Function.


Dim MyAngle, MyCosecant As Double
MyAngle = 1.3 ' Define angle in radians.
MyCosecant = 1 / Sin(MyAngle) ' Calculate cosecant.
Sqrt

The Sqrt function returns a Double value that specifies the square root of the specified
number.

Sqrt example:

This example uses the Sqrt method of the Math class to calculate the square root of a


number.

' Code is not compiled unless it is put in a Sub or in a Function.


Dim MySqr As Double
MySqr = Sqrt(4) ' Returns 2.
MySqr = Sqrt(23) ' Returns 4.79583152331272.
MySqr = Sqrt(0) ' Returns 0.
MySqr = Sqrt(-4) ' Returns NaN (not a number).
Tan 

The Tan function returns a Double value that contains the tangent of the specified angle.
The Tan function takes an angle that is measured in radians as the argument. When the
angle that is specified is NaN, NegativeInfinity, or PositiveInfinity, this method returns NaN. 

Note Multiply by π/180 to convert degrees to radians.

Tan example:

This example uses the Tan method of the Math class to return the tangent of an angle.

' Code is not compiled unless it is put in a Sub or in a Function.


Dim MyAngle, MyCotangent As Double
MyAngle = 1.3 ' Define angle in radians.
MyCotangent = 1 / Tan(MyAngle) ' Calculate cotangent.
(if its less then see book page no. 112)

You might also like