| ||||||||
|
There are a lot of things to learn about files, graphics, and printing. This section should help you get started in understanding some of these concepts. FilesFiles are used to contain programs and to store data. Typically, applications and "data files" work together. For example, a word processor application stores data (a letter or other document) in a file so that it can be recalled and edited later. Applications or programs may share data files. For example, in some word processors you can load files from other word processors. Types of Files Files may contain text, images, databases, and audio and video data. Data can be read using a text editor if it is in "text" (also called ASCII) format. Other files, such as graphics, use a "binary" format. Binary formats are usually read by specific applications. Working with files
involves three steps:
Opening the file means telling the computer which file you want (the filename), how you want it opened (for input, output, append), what type it is (binary, text), and then assigning a handle to it. A handle is usually a unique number that allows you to keep track of the file that is opened. Reading and writing from or to a file is a matter of sending the data to the file by referencing the file handle. The process is similar to writing to a printer or reading from user input. Closing a file is simply a matter of telling the computer you are done. For example: Open filename.txt for input as #1 'open the file to get data Tbox.text = input(100,#1) 'get 100 characters from the file Close 1 'close the file when you are done GraphicsGraphics are pictures that can be displayed on the computer. Graphics are displayed by manipulating pixels (spots of color on the screen) to various colors to create the picture. Picture and image objects are most commonly used to store and display graphics. You can usually access specific pixels to examine and modify graphics. You can also use point, line, and circle functions to draw on the object. This process combines the use of methods and events to manage drawing operations:
PrintingPrinting is the process of sending data to a printer. It can also mean sending data to the screen or to a file. Typically, printing will involve setting up the printer and selecting the printer, printing mode (color, graphic mode), numbers of copies, and so forth. Many of these functions are handled by the operating system in common dialogs that can be accessed by all applications. Most programming languages treat the printer as an output device to which data is sent for display (printing).
DatabasesFor more detail, please visit...Database Concepts. Databases are repositories of information typically organized to allow selection of specific subsets of information and updating, removal, and addition of new information. Flat FilesThese are "cheap" databases. Data is stored as lines of text with little or no internal or external referencing. No tools are specifically available for easy access, updating, deleting, and adding (you could use a word processor to create and manage a flat file). The following is a typical example of a flat file layout:
Note that the field names are indicated in the first row. Fields are separated by commas. Tabs, quotations, and other characters may also be used to separate fields.
Relational DatabasesFor more detail visit the Database Bootcamp! Relational databases enable you to organize information in natural ways. For example a corporate database would include information about:
Each of these groups of information would thoroughly describe the topic. Relationships may exist between these groupings. For example, employees will staff projects; projects have costs; and facilities house employees. Technically
speaking, relational databases consist of:
Tables Let's take a closer look at tables. Tables in relational databases are used to organize complex information sets. Each table in a database is used for a specific grouping of information. For example, a corporate database might contain:
Note that each table has unique information that is not found in other tables. Good table design means: never repeating data (e.g., an employee address only appears once). Fields and Data Types Fields in a table describe the kind and nature of the information that is being stored. For example, using our employee table:
SQLStructured Query Language (SQL) is the ANSI (American National Standards Institute) standard relational database language used for managing objects, data, and security. SQL is supported by many commercial database products as a means to access and manage databases. There are 6 basic statements in SQL:
The following sections describe the syntax for each of these statements: Select Select — columns of data to be retrieved Example: SELECT lastname, firstname, address, city, state, zip FROM employee WHERE state='MD' GROUP BY zip Where operators include: =, >, <, >=, <=, <> (not equal) IN, BETWEEN..AND, LIKE Linking relationships can join tables. For example: · Two tables: employee (with studentid, lastname, firstname, address, etc..), project (projectid, emplyeeid) · Employee table has a field: employeeid · Project table has a field: employeeid Example: SELECT employee.lastname, employee.firstname FROM employee, project WHERE employee.employeeid = project.employeeid This query joins two tables and provides the student names. Insert Insert Into -- which table will have rows added Example: INSERT INTO employee (lastname, firstname, address, city, state, zip) VALUES ('Smith', 'David', '111 Elm Street', 'Anycity', 'MD', '20872') Update Update — table to be updated Example: UPDATE students SET address = '99 Elm St' WHERE lastname = 'Smith' Delete Delete From — specify table in which rows are to be deleted Example: DELETE FROM employee WHERE employeeid = 10 Create Create Table — table to be created Select Into Select column list — columns to build the new table Example: SELECT lastname, firstname INTO localemployees FROM employee WHERE state = 'MD'
|
|
Copyright © 1999
- 2005 |