- Shopping Bag ( 0 items )
Ships from: Chicago, IL
Usually ships in 1-2 business days
Ships from: Chatham, NJ
Usually ships in 1-2 business days
- About Visual FoxPro 5
- What's New about Visual FoxPro
- About This Book
- How to Use This Book
- What You're Not to Read
- Foolish Assumptions
- How This Book Is Organized
- Part I: Databases and Tables
- Part II: Ways Programmers Manipulate Data
- Part III: Working with Forms
- Part IV: Reports, Labels, and Graphs
- Part V: Things That Make a Big Difference
- Part VI: The Part of Tens
- Icons Used in This Book
- Where to Go from Here
Part I: Databases and Tables
- Chapter 1: Creating a Database
- Installing Visual FoxPro
- Starting Visual FoxPro
- Understanding Basic Database Terminology
- Creating the Database
- Chapter 2: Adding Content to Your Database
- Choosing Your Data
- Refining your data list
- Planning Your Field Size
- Breaking Up the Data into Tables
- Building a Table
- Setting special table properties
- The record validation area
- Adding Fields to a Table
- Setting Special Field Properties
- Setting the Display properties
- Setting the field validation properties
- The 13 field types
- Chapter 3: Indexing Your Database
- Using an Index
- Planning an Index
- Creating an Index on One Field
- Creating Multiple Field Indexes
- Inserting Expressions and Filters
- Turning an Index On and Off
- Modifying an Index
- Deleting an Index
- Chapter 4: Working with Data
- Accessing Data Without Using a Form
- Inserting Records into a Table
- Paying Attention to Indexes When Adding Data
- Displaying the Data: The Browsing Method
- Editing the Data in Fields
- Deleting Data
- Deleting and undeleting records
- Deleting records for good
- Hiding (and unhiding) records that are marked to be deleted
- Saving Data
- Chapter 5: Rearranging the Data
- Displaying a Selection of Fields
- Moving Fields in a Table
- Squeezing Fields onto the Screen
- Sorting Records
- Making the Sort Permanent
- Sorting selected fields with the SORT command
- Sorting selected records
- Chapter 6: Changing the Structure of a Table
- Modifying the Table Structure
- Changing a field's definition
- Changing a field name
- Changing a field's data type
- Changing a field width
- Changing the number of decimal places
- Changing the NULL attribute
- Adding a New Field to a Table
- Deleting a Table Field
- Checking Indexes and Common Fields
- Chapter 7: Tricks with Views
- Creating a View
- Displaying the View
- Removing a View
Part II: Ways Programmers Manipulate Data
- Chapter 8: Searching Databases
- Using Edit-->Find (A Simple Search)
- Using Table-->Go to Record
- Top, Bottom, Next, and Previous
- Record #
- Searching by Using the Command Window
- Using the Command Window
- Setting the stage for the search
- Chapter 9: Filtering Data
- Understanding Filters
- Creating a Filter
- Removing a Data Filter
- Filtering on More Than One Field
- Filtering on a Partial Value of a Field
- Using substrings in a filter expression
- Using a substring in an expression
- Filtering Data Across Multiple Tables
- Chapter 10: The Fancy Way to Query Data
- Creating a Query
- Running the Query
- Saving the Query
- Running an Existing Query
- Modifying an Existing Query
- Specifying a Destination for Your Query
Part III: Working with Forms
- Chapter 11: Creating Forms
- Understanding Forms
- Creating a Form
- Using the Form Designer Toolbar
- Understanding the Form Properties
- Assigning an Icon to the Form
- Using Controls
- Displaying the Form Controls toolbar
- Placing a control in the form
- Repositioning a control in the form
- Using the Layout Toolbar
- Grid lines
- Position marker
- Layout window
- Setting Tab Order
- Running the Form
- Chapter 12: Adding Controls to a Form
- Label Control
- Label text
- Alignment of text
- Label border
- See-through label background
- Label color
- Label fonts
- Text Box Control
- Alignment, color, and font for a text box
- Maximum number of characters
- Assigning a field to a text box
- Status bar help
- Text Box Builder
- Read-only data
- Edit Box Control
- Command Button Control
- Pictures on the command button
- Command Button Code Window
- Default OK and Cancel
- Command Group Control
- Setting the number of buttons
- Placing captions and graphics on buttons
- Using the Layout tab of the Command Group Builder
- Option Group Control
- Check Box Control
- Using a picture in place of a check mark
- Adding check-box special effects
- Combo Box Control
- Using the List Items tab of the Combo Box Builder
- Using the Style tab of the Combo Box Builder
- Using the Layout tab of the Combo Box Builder
- Using the Value tab of the Combo Box Builder
- List Box Control
- Grid Control
- Line Control
- Shape Control
- Chapter 13: Making Controls Do Something
- Displaying the Value of a Field
- Assigning a Field Value to a Control
- Moving to the Next Record
- Moving to the Preceding Record
- Moving to the Bottom of the Table
- Appending a New Record to the Table
- Deleting a Record
Part IV: Reports, Labels, and Graphs
- Chapter 14: Creating Reports and Labels
- Creating a Quick Report
- Creating a Customized Report
- Using the Report Designer
- Creating a Report
- Working with Objects in a Report
- Aligning objects by using grid lines
- Aligning objects by using position markers
- Aligning objects by using the Layout toolbar
- Moving an object in a report
- Resizing an object in a report
- Deleting an object from a report
- Adding Color to a Report
- Placing Shapes in a Report
- Placing a line in a report
- Placing a rectangle in a report
- Placing a rounded rectangle in a report
- Enhancing shapes in a report
- Placing Pictures in a Report
- Grouping Data in a Report
- Changing the Font in a Report
- Linking a Query to a Report
- Using Print Preview
- Printing a Report Quickly
- Creating and Printing Mailing Labels
- Grouping Labels
- Linking a Query to a Label
- Printing Labels
- Performing a Mail Merge
- Chapter 15: Making Data into a Graph
- Changing Data into a Graph
- Understanding Basic Graphing
- Creating a Graph
- Using the Graph Wizard to create specifications
- Using a query to create specifications
- Displaying a Graph
Part V: Things That Make a Big Difference
- Chapter 16: Networking, Remote Computing, and the Internet
- Connecting Computers
- Understanding servers
- Understanding conflicts among computers
- Solving network performance problems
- Accessing a Remote Database
- Connecting to a remote database
- Finding data in a remote database
- Putting Your Data on the Internet
- Adding a database to your Web page
- Creating your search page
- Placing your search page on the Web server
- Chapter 17: Classes and ActiveX
- Creating Classes
- Understanding inheritance
- Making your own class
- Creating your own class
- Using your own class
- Tapping into ActiveX
- Chapter 18: Creating a Macro
- Deciding When a Macro Is Useful
- Macros can't do everything
- Recording a Macro
- Testing Your Macro
- Loading Your Macro into Memory
- Automatically Loading Macros
- Stopping Macros from Loading
- Changing the Default Macro File
- Deleting a Macro
- Editing a Macro
- Chapter 19: Identifying Parts of a Project
- Analyzing a Noncomputerized System
- The concept of input output
- Identifying data input, data processing, and data output
- Identifying data flow
- Identifying Pieces of a Computerized System
- Building the database
- Building views
- Building the indexes
- Building forms
- Building reports
- Creating a Project
- Making a new project
Part VI: The Part of Tens
- Chapter 20: Ten Useful Things to Type in the Command Window
- USE and BROWSE
- APPEND BLANK, DELETE, and PACK
- MODI STRUCT
- Chapter 21: Ten Top Operators
- Equal (=)
- Not Equal (<>)
- Greater Than (>)
- Less Than (<)
- Greater Than or Equal To (>=)
- Less Than or Equal To (<=)
- Group ( )
- Chapter 22: Ten Things That Sometimes Go Wrong
- A Window Disappears When You Open Another Window
- Tables Just Don't Relate
- You Can't Find Data That You Know Is in the Database
- The Search for Data Comes Up Empty
- You Can't Recall Records That Were Deleted
- You Got .AND. and .OR. Mixed Up
- You Forgot a Field in a Table
- You Can't Search a Remote Database
- You Can't Run the Visual FoxPro Search Page for Your Web Site
- Color in Reports Doesn't Match Color On-Screen
- Chapter 23: Ten Places to Find Help
- Online Help
- Online Documentation
- Visual FoxPro Manuals
- Visual FoxPro Technical Support Lines
- Community Colleges
- Training Companies
- Computer Stores
- User Groups
- The Internet
- Chapter 24: Ten Best Keyboard Shortcuts
- Esc (The Universal Go-Away Key)
- Ctrl+Z (To Undo the Last Change)
- Ctrl+C (To Copy)
- Ctrl+V (To Paste)
- Ctrl+X (To Cut)
- Ctrl+Y (To Add a Record)
- Ctrl+T (To Mark a Record for Deletion)
- Ctrl+F4 (To Close the Current Window)
- Ctrl+F2 (To Open the Command Window)
- F1 (To Get Online Help)
- Chapter 25: Ten Features to Explore Someday
- Using the Spell Checker
- Using Those Other Things in the Expression Builder
- Importing and Exporting Your Stuff
- Getting Organized By Using a Project File
- Doing the Whole Programming Thing
- Finding Data Phonetically
- Using the SQL Language
- Using the Debugger
- Using the Setup Wizard
- Using OLE
- Appendix: Tips on Installing Visual FoxPro
- Check Out the Facts Before Starting the Installation
- Do you have the right equipment?
- If you don't have the right equipment
- Installing Visual FoxPro
- The basic installation
- Adding and removing components
- What to do when Visual FoxPro doesn't work
- Configuring Visual FoxPro
- Setting up the Visual FoxPro environment
- Customizing the Visual FoxPro toolbar
Reader Response Card
In This Chapter
You've probably heard about someone cracking the password that allowed her to gain access to government secrets -- from her home at the other end of the country. Makes you wonder whether anything is safe these days.
Computer security is breached on occasion in real life -- and all the time in the movies -- because computers are connected to other computers. The link between computers is called a network, and in this chapter, I explore ways that Visual FoxPro can be used on a computer network. (I don't show you how to break into the Pentagon's computers, however.)
I talk about three types of computer networks in this chapter:
Remember when your schoolteacher punched a hole in the bottom of two paper cups and tied them together with a string? A couple of kids pulled the string taut; then one of them spoke into one cup and the other listened in the other cup. A miracle had occurred: The teacher had made two cups and a string into a telephone.
Actually, the teacher created a small network that consists of two computers (cups) that are joined by a cable (string). Computer networks are more sophisticated than cups and a string, of course, but the same basic process occurs. One computer (cup) sends another computer (cup) information electronically over a cable (string) that can transmit the information over a distance. This setup is a simple computer network.
Each computer connected to the cable has an address, just like each house on a street has an address. Special network software acts like a traffic cop, making sure that each piece of information reaches the correct computer.
At least one computer connected to the network is designated as the center of the network. That computer is called a server. Think of a server as being the computer that is used to store information shared by the other computers in the network. A server frequently is the computer that runs the network, although more than one server can be connected to the network, with only one of those servers actually running the network.
Computers that talk to the server over the network are called clients. You've probably seen the term client/server used in the press (and heard it used by the geeks in your office). The term is used to describe a computer network. Simply put, clients (computers like your PC) are connected to a server (such as a shared hard disk) through cables called a network. Sometimes, the server on a network is referred to as a file server.
You store your programs and your database on the hard disk inside your computer. You can store programs and a database on a floppy disk or a CD -ROM, of course, but most people use a hard disk.
Only your computer can get to the information stored on your hard disk. A friend can't access your data if your friend's computer and your computer aren't connected. You probably don't want a friend snooping around your hard disk, anyway.
You do want to share information, however, if you and the rest of your friends are working on the same project, such as building the FoxPro database that's going to make all of you millionaires. You can share information such as programs and a database by creating a local-area network (LAN), which is a bunch of computers connected by a cable.
At the center of the network is a file server that runs the LAN and stores all the files that you want to share on the file server's hard disk. A file server is little more than a shared hard disk. You can place your files on the file server, and someone else whose computer is connected to the network can use those files. You don't have to use sneaker net to exchange files. (You're using sneaker net when you load your file onto a floppy disk, put on your sneakers, and run the disk over to your friend so that she can use your file.)
Whenever you or your friends want to run a program or look at data in a database, you tell your computer to look for those files on the file server's hard disk. The hard disk usually is identified as the F drive (or another letter) when you log into the network. You then refer to the server's hard disk by that letter, just as you refer to your computer's hard disk as C.
Suppose that you create a database containing the names and addresses of all the businesses in your area. The database is stored on the file server's hard disk. Whenever you want to locate the address of a business, you tell Visual FoxPro to use the database located on the file server.
Some people consider a file server to be different from a client/server, although both a file server and client/server are computers connected to other computers in a network. The difference between a file server and client/server is a bit technical, but you'll have no problem understanding the concept.
When you query your database located on your hard disk, your computer goes to work, obeying Visual FoxPro's instructions to do the following:
When you query a database located on a file server, your computer performs the same work, with one important exception: Records from the database travel from the file server along the cable to your computer; then your computer compares the records with the search criteria.
When you query a database located on a client/server, your computer sends the search criteria to the client/server and asks the client/server to find the matching record. The client/server then goes to work comparing records in the database. Your computer sits backs and waits for the client/server to send the matching record.
A computer network enables you and your friends to share resources. Although I've been talking about sharing only programs and data, a network also allows you to share printers and modems. Because this book talks about databases, I don't discuss those other shared resources.
You may have problems sharing practically everything. Remember the fights that ensued when you and a friend tried to grab the same toy? Similar problems -- minus the bruises -- occur when more than one computer tries to the use the same record from the database at the same time. The nerd term for this situation is contention. In some cases, no computer receives the record because of the conflict.
Contention occurs by chance, similar to lightning strikes. People get hit by lightning, but the conditions must be perfect for the strike to occur. The same is true of contention. You experience contention infrequently when you use a file server and even less often when you use a client/server. Client/server software has a better opportunity to prevent the perfect conditions from occurring because the client/server performs all the processing.
Although contention occurs infrequently, a common problem is for a person to lose changes made in a record shared on a file server because the changes are overwritten by another person.
Suppose that you want to change the department number of John Smith. You open the database and display the record in the table that contains John Smith's department number. You make the change in the record and close the table, and Visual FoxPro saves the changes to the database.
A problem arises, however, when someone else wants to change information in John Smith's record at the same time that you're changing the department number. Only one person can make changes in the same record at the same time.
Here's what happens behind the scenes:
Client/server software prevents common conflicts among computers because computers request information from the database and the client /server does all the searching and updating of records. The client/server knows to update and save the record before making other changes in the record.
File-server software does not prevent common conflicts among computers unless each computer takes necessary precautions when its user records changes.
Visual FoxPro automatically locks a table whenever a record in the table is being updated, such as when you:
Don't feel that Visual FoxPro takes care of conflicts for you; it prevents conflicts from occurring only when it updates the table.
When you want to insert a new record into a table, save a record in the table, or delete a record from a table, you give Visual FoxPro a command. The program locks the table while the record is being updated; then it immediately unlocks the table. No one can use the table while the table is locked.
No lock is placed on the table while you're making changes in the record, however. You can make changes in the record while you are viewing a copy of the record. The actual changes occur only when you tell Visual FoxPro to close the table or save the table. Other computers still have access to the table while you're making the changes in the record.
Locking and unlocking a table
You can prevent conflicts from occurring by locking the table before you begin making changes. The other computers can access other tables of the database but not the table that you're using until you stop using the table.
You must remember to release the lock on the table, though; otherwise, other computer users will hunt you down like a fox.
Here's how you lock tables:
Any time you open any table by choosing File-->Open, Visual FoxPro automatically locks the table.
The Command Window remains open.
Here's how you unlock tables:
Visual FoxPro automatically unlocks tables that are open or are opened after you press Enter.
You should follow two general rules to prevent conflicts whenever you use a database that is located on a file server:
You can lock individual records by using the
RLOCK() command before you open the record; using the
UNLOCK() command removes the locks. I don't go into detail on how to use
UNLOCK() because the
SET EXCLUSIVE command is easier to understand and use.
Sharing information in a network requires all the people who are using the network to have consideration for one another. The first consideration is to avoid hogging the database by locking tables and records unnecessarily.
Performance is another concern. All the computers in the network are using the same resource -- usually the file server. So while you're asking for a large file or a large number of records from the file server, it ignores other requests.
To reverse the situation a little, the time that you must wait for the file server to send you a file depends on how many requests are ahead of your request. If you wait too long, you'll complain to the system administrator (the person who is responsible for the network) about the network's lack of performance.
The problem occurs when someone makes an unreasonable request of the file server. Here are a couple of ways to avoid causing performance problems on the network:
Suppose that you always want to see records in a table by a person's department name, last name, and first name. You can sort the records in the table or leave the records in data-entry order and use an index. Sorting the table increases the performance of the network.
An index requires a two-step process. First, Visual FoxPro opens and reads the index; then it opens and reads the table. A sorted table, however, requires only one step: Visual FoxPro opens and reads the table.
Everyone else must wait until you change and save the copy of the record. Performance improves for everyone if you make changes when few, if any, other users need to see information in the table.
I suggest that you don't worry too much about performance until you experience long wait times or hear that other users are having long wait times. If performance falls off, call your system administrator.
A client/server is similar to a file server, except that the client/server does most of the work with the database.
Suppose that you need all the information about XYZ Co., and the information is stored in a database on a client/server. You use Visual FoxPro to place your request in the proper format and send the request to the client /server's database. Your computer waits for the client/server to extract and send you the information that you requested. The entire search is performed outside your computer.
The database on the client/server does not have to be a Visual FoxPro database. You can use Visual FoxPro to access practically any database supported by the Microsoft Open Database Connectivity driver (ODBC), such as a Paradox database or a SQL database.
Suppose that your company has a SQL database located on a client/server, and you want to query the database. You can do so by using Visual FoxPro if the database is supported by ODBC. (Your system administrator can tell you whether it is.)
You must connect your computer to a remote database before you can access data from it. Follow these steps:
The Connections dialog box contains several options, but you need to deal with only four: Data Source, User ID, Password, and Database. (The Data Source list displays all the remote databases that you can use with Visual FoxPro.) I suggest that you consult your system admin istrator to determine the settings for the connection.
Data Source is the remote computer to which you want to connect.
User ID is the user ID that lets you log onto the remote computer.
Password is the password that is used to log onto the remote computer.
The Select Database dialog box opens, allowing you to select the remote computer and database by using the same technique that you use to open a file from the Open dialog box.
After you make the connection to the remote database, you can search the database for information by using the Query Wizard. Follow these steps:
Visual FoxPro displays the Wizard Selection dialog box, shown in Figure 16-1.
Note that the wizard's description also appears in the dialog box.
The remaining Remote View Wizard settings are obvious, so I don't go into too much detail here. You're asked to select the remote database and then choose the tables and fields to which you want to connect. You're then asked to choose the fields that you want to use to sort records as well as an expression to filter out unwanted records. You make your choices from lists displayed on-screen.
The information is returned to your computer from the remote database and displayed on your screen.
By now, you've probably heard about the Internet revolution, and you may have explored the Internet yourself. I assume that you know how the Internet works and know how to create a Web page. If you're preparing to build your own page on the Net or to enhance your existing page with database capabilities, read on.
In this section, I show you how to give the world access to your Visual FoxPro database. The program can build the page, database, and database connection for you.
If you'd like more information about the Internet, check out The Internet For Dummies®, 4th Edition, by John R. Levine, Carol Baroudi, and Margaret Levine Young (IDG Books Worldwide, Inc.) for a complete discussion.
You can allow visitors to your Web page to search information in your database if you link your Visual FoxPro database to your Web page. Suppose that you want to provide a directory of merchants in your community. Anyone who is looking for a good place to eat or purchase hardware supplies can use a computer to connect to your Web page. When the visitor connects, he enters in a text box the service that he wants to use and then clicks the Search button. The Web server searches your database and returns to the visitor information about appropriate merchants.
You can use Visual FoxPro to provide database lookup access to any visitor to your Web page. Before you become too excited, however, I have to tell you about the restrictions:
Typically, your database Web page is one of several pages that comprise your Web site. A Web site usually has an opening page from which visitors can jump to other pages in your Web site, one of which is the search page. The search page is the place where the visitor enters search criteria. Here's how you create a search page:
Refer to Chapters 1 and 2 if you need to brush up on how to create databases and tables.
This data is the information that visitors to your Web site will search.
The Internet Search Wizard steps you through each phase of building the database Web page.
The title can be something like "Where to Shop in My Town." The description can be something like "Welcome to my shopping guide. Enter the type of service that you need in the box; then click the Search button. Information about merchants is displayed on-screen."
An image is an electronic picture, such as the Visual FoxPro logo. You can purchase commercial pictures from your local computer store or through mail-order houses. The background image is the electronic picture that appears as the background of the page, and the header image is the electronic picture that appears between the title and the header.
I find that trying different electronic pictures as the background image and the header image is the best way to decide which pictures are best for your page.
These fields make up what is called the return page. You also determine the electronic pictures to be used as the background image and header image on the return page.
Visual FoxPro displays returned information in the form of a grid; columns are the fields that you selected, and rows are records of information. The wizard asks you to decide how many records you want to display in the return page. The default value is ten records, which probably is sufficient for most return pages.
Visual FoxPro prompts you to enter the file name for the search page.
Visual FoxPro creates the search page for you.
The Internet Search Wizard creates three files, which you copy to your Web server. Your Web site provider can help you move the files into the proper directory on the Web server. The wizard generates the following files (replace <myfile> with the names that you gave the .HTM file):
Note: The .HTM file contains your search page; the other files are used to connect to your database.
When you copy these files to the Web server (which must have the proper copy of Visual FoxPro and compatible server software), you're almost ready for your first visitor.
The final step is to link the search page to your home page (or another appropriate page) of your Web site. The home page is the first page that the visitor sees when she enters your Web site.
Behind the scenes on your Web server
If you're like me, you want to know a little of what actually happens when someone uses your search page. I'll share what I have found:
Posted February 29, 2000
I've purchased 'Dummies' books before to get a quick synopsis of a topic. But this one by far, is a terrible buy. I knew nothing about FoxPro before and regardless of what I learned from the book, the author did a terrible job. Most learning books have you build a project or something, but there was nothing like that here. You would think the author was going somewhere with a project, and then he'd just start a new paragraph with something else. Plus, many figured did NOT match the text. The author was also guilty of many 'but, we'll cover that later' or 'but we covered that in chapter X'. This was a poor, poor buy. IDG books are usually good, this wasn't.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.