100% found this document useful (1 vote)
84 views

(Ebook) C# Programming: From Problem Analysis to Program Design by Barbara Doyle ISBN 9781285096261, 1285096266 instant download

The document provides information about the ebook 'C# Programming: From Problem Analysis to Program Design' by Barbara Doyle, including various ISBNs and links for downloading. It also mentions other related programming ebooks by different authors. The content covers a range of programming topics and is published by Cengage Learning.

Uploaded by

sibaliremoun32
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
84 views

(Ebook) C# Programming: From Problem Analysis to Program Design by Barbara Doyle ISBN 9781285096261, 1285096266 instant download

The document provides information about the ebook 'C# Programming: From Problem Analysis to Program Design' by Barbara Doyle, including various ISBNs and links for downloading. It also mentions other related programming ebooks by different authors. The content covers a range of programming topics and is published by Cengage Learning.

Uploaded by

sibaliremoun32
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

(Ebook) C# Programming: From Problem Analysis to

Program Design by Barbara Doyle ISBN


9781285096261, 1285096266 download

https://ebooknice.com/product/c-programming-from-problem-
analysis-to-program-design-4178294

Explore and download more ebooks at ebooknice.com


Here are some recommended products for you. Click the link to
download, or explore more at ebooknice.com

(Ebook) C# Programming: From Problem Analysis to Program Design


by Barbara Doyle ISBN 1423901460

https://ebooknice.com/product/c-programming-from-problem-analysis-to-
program-design-2444624

(Ebook) C# Programming: From Problem Analysis to Program Design


by Barbara Doyle ISBN 9781285856872, 1285856872, 2015937761

https://ebooknice.com/product/c-programming-from-problem-analysis-to-
program-design-10810090

(Ebook) C++ Programming: From Problem Analysis to Program Design


by D. S. Malik ISBN 9781133626381, 1133626386

https://ebooknice.com/product/c-programming-from-problem-analysis-to-
program-design-4334672

(Ebook) C++ Programming: From Problem Analysis to Program Design


by D. S. Malik ISBN 9781337102087, 1337102083

https://ebooknice.com/product/c-programming-from-problem-analysis-to-
program-design-7031230
(Ebook) C++ programming : from problem analysis to program
design by D S Malik ISBN 9781423902096, 1423902092

https://ebooknice.com/product/c-programming-from-problem-analysis-to-
program-design-4700604

(Ebook) C++ Programming: From Problem Analysis to Program


Design, 5th by D. S. Malik ISBN 9780538798082, 0538798084

https://ebooknice.com/product/c-programming-from-problem-analysis-to-
program-design-5th-2336846

(Ebook) Java Programming: From Problem Analysis to Program


Design, 4th Edition by D. S. Malik ISBN 1439035660

https://ebooknice.com/product/java-programming-from-problem-analysis-to-
program-design-4th-edition-2365278

(Ebook) Java(TM) Programming: From Problem Analysis to Program


Design by D. S. Malik ISBN 9781111530532, 111153053X

https://ebooknice.com/product/java-tm-programming-from-problem-analysis-to-
program-design-2271130

(Ebook) Java programming : from problem analysis to program


design by D S Malik ISBN 9781111530532, 9781111577643,
111153053X, 1111577641

https://ebooknice.com/product/java-programming-from-problem-analysis-to-
program-design-4130342
C# PROGRAMMING:
FROM PROBLEM ANALYSIS TO PROGRAM DESIGN

FOURTH EDITION

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
This is an electronic version of the print textbook. Due to electronic rights restrictions,
some third party content may be suppressed. Editorial review has deemed that any suppressed
content does not materially affect the overall learning experience. The publisher reserves the right
to remove content from this title at any time if subsequent rights restrictions require it. For
valuable information on pricing, previous editions, changes to current editions, and alternate
formats, please visit www.cengage.com/highered to search by ISBN#, author, title, or keyword for
materials in your areas of interest.

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
C# PROGRAMMING:
FROM PROBLEM ANALYSIS TO PROGRAM DESIGN

FOURTH EDITION

BARBARA DOYLE

Australia l Brazil l Japan l Korea l Mexico l Singapore l Spain l United Kingdom l United States

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
C# Programming: From Problem Analysis © 2014 Cengage Learning
to Program Design, Fourth Edition
ALL RIGHTS RESERVED. No part of this work covered by the copyright
Barbara Doyle herein may be reproduced, transmitted, stored or used in any form or
by any means graphic, electronic, or mechanical, including but not
Executive Editor: Kathleen McMahon
limited to photocopying, recording, scanning, digitizing, taping, Web
Senior Product Manager: Alyssa Pratt distribution, information networks, or information storage and
Editorial Assistant: Sarah Ryan retrieval systems, except as permitted under Section 107 or 108 of the
1976 United States Copyright Act, without the prior written permission
Content Project Manager: Jennifer Feltri-George
of the publisher.
Art Director: Cheryl Pearl, GEX
Manufacturing Planner: Julio Esperas
Cover Designer: GEX Publishing Services For product information and technology assistance, contact us at
Cover Photo: ©iurii /Shutterstock Cengage Learning Customer & Sales Support,
www.cengage.com/support
Copyeditor: Andrea Schein
Indexer: Sharon Hilgenberg For permission to use material from this text or product,
submit all requests online at cengage.com/permissions
Compositor: Integra
Further permissions questions can be e-mailed to
[email protected]

Library of Congress Control Number: 2013932312


ISBN-13: 978-1-285-09626-1
ISBN-10: 1-285-09626-6
Cengage Learning
20 Channel Center Street
Boston, MA 02210
USA

Some of the product names and company names used in this book have
been used for identification purposes only and may be trademarks or
registered trademarks of their respective manufacturers and sellers.
Any fictional data related to persons or companies or URLs used
throughout this book is intended for instructional purposes only. At the
time this book was printed, any such data was fictional and not
belonging to any real persons or companies.
Cengage Learning reserves the right to revise this publication and
make changes from time to time in its content without notice.
The programs in this book are for instructional purposes only. They
have been tested with care, but are not guaranteed for any
particular intent beyond educational purposes. The author and the
publisher do not offer any warranties or representations, nor do they
accept any liabilities with respect to the programs.
Cengage Learning is a leading provider of customized learning
solutions with office locations around the globe, including
Singapore, the United Kingdom, Australia, Mexico, Brazil, and Japan.
Locate your local office at: www.cengage.com/global
Cengage Learning products are represented in Canada by Nelson
Education, Ltd.
To learn more about Cengage Learning visit
www.cengage.com.
Purchase any of our products at your local college store or at our
preferred online store: www.cengagebrain.com

Printed in the United States of America


1 2 3 4 5 6 7 19 18 17 16 15 14 13
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
B RIEF C ONTENTS

Neale Cousland / Shutterstock.com

PREFACE xxi

1. Introduction to Computing and Programming 1

2. Data Types and Expressions 65

3. Methods and Behaviors 131

4. Creating Your Own Classes 191

5. Making Decisions 247

6. Repeating Instructions 313

7. Arrays 383

8. Advanced Collections 439

9. Introduction to Windows Programming 493

10. Programming Based on Events 577

11. Advanced Object-Oriented Programming Features 691

12. Debugging and Handling Exceptions 775

13. Working with Files 837

14. Working with Databases 893

15. Web-Based Applications 979

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
vi | C# Programming: From Problem Analysis to Program Design, Fourth Edition

APPENDIX A Visual Studio Configuration 1083

APPENDIX B Code Editor Tools 1099

APPENDIX C Character Sets 1111

APPENDIX D Operator Precedence 1113

APPENDIX E C# Keywords 1115

GLOSSARY 1117

INDEX 1131

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
TABLE OF C ONTENTS

Neale Cousland / Shutterstock.com

Preface xxi

INTRODUCTION TO COMPUTING AND PROGRAMMING 1


1 History of Computers 2
System and Application Software 4
System Software 4
Application Software 6
Software Development Process 6
Steps in the Program Development Process 7
Programming Methodologies 13
Structured Procedural Programming 14
Object-Oriented Programming 16
Evolution of C# and .NET 19
Programming Languages 19
.NET 21
Why C#? 23
Types of Applications Developed with C# 24
Web Applications 24
Windows Applications 25
Console Applications 26
Exploring the First C# Program 27
Elements of a C# Program 28
Comments 28
Using Directive 30
Namespace 32
Class Definition 32

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
viii | C# Programming: From Problem Analysis to Program Design, Fourth Edition

Main( ) Method 33
Method Body Statements 34
Compiling, Building, and Running an Application 38
Typing Your Program Statements 38
Compilation and Execution Process 39
Compiling the Source Code Using Visual Studio IDE 39
Debugging an Application 45
Syntax Errors 45
Run-time Errors 47
Creating an Application 47
Coding Standards 52
Pseudocode 52
Resources 53
Quick Review 53
Exercises 56
Programming Exercises 61

DATA TYPES AND EXPRESSIONS 65


2 Data Representation 66
Bits 66
Bytes 66
Binary Numbering System 66
Character Sets 69
Kilobyte, Megabyte, Gigabyte, Terabyte, Petabyte. . . 70
Memory Locations for Data 70
Identifiers 71
Variables 75
Literal Values 75
Types, Classes, and Objects 76
Types 76
Classes 77
Objects 78
Predefined Data Types 79
Value Types 80

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents | ix

Integral Data Types 82


Floating-Point Types 85
Decimal Types 86
Boolean Variables 87
Declaring Strings 88
Making Data Constant 88
Assignment Statements 89
Basic Arithmetic Operations 92
Increment and Decrement Operations 95
Compound Operations 98
Order of Operations 100
Mixed Expressions 102
Casts 103
Formatting Output 104
Width Specifier 109
Coding Standards 119
Naming Conventions 119
Spacing Conventions 119
Declaration Conventions 120
Resources 120
Quick Review 120
Exercises 121
Programming Exercises 127

METHODS AND BEHAVIORS 131


3 Anatomy of a Method 132
Modifiers 134
Return Type 137
Method Name 138
Parameters 138
Method Body 139
Calling Class Methods 141
Predefined Methods 143
Writing Your Own Class Methods 157
Void Methods 157
Value-Returning Method 159
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
x | C# Programming: From Problem Analysis to Program Design, Fourth Edition

Types of Parameters 164


Named and Optional Parameters 169
Default Values with Optional Parameters 170
Named Parameters 171
Coding Standards 180
Naming Conventions 180
Spacing Conventions 180
Declaration Conventions 180
Commenting Conventions 181
Resources 181
Quick Review 181
Exercises 182
Programming Exercises 189

CREATING YOUR OWN CLASSES 191


4 The Object Concept 192
Private Member Data 193
Constructor 197
Writing Your Own Instance Methods 200
Accessor 200
Mutators 201
Other Instance Methods 202
Property 202
ToString( ) Method 204
Calling Instance Methods 206
Calling the Constructor 206
Calling Accessor and Mutator Methods 208
Calling Other Instance Methods 209
Testing Your New Class 210
Coding Standards 235
Naming Conventions 235
Classes 235
Properties 235
Methods 236

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents | xi

Constructor Guidelines 236


Spacing Conventions 236
Resources 236
Quick Review 237
Exercises 238
Programming Exercises 244

MAKING DECISIONS 247


5 Boolean Expressions 248
Boolean Results 248
Conditional Expressions 249
Equality, Relational, and Logical Tests 250
Short-Circuit Evaluation 258
Boolean Data Type 260
if. . .else Selection Statements 261
One-Way if Statement 261
Two-Way if Statement 266
Nested if. . .else Statement 273
Switch Selection Statements 279
Ternary Operator ? : 283
Order of Operations 285
Coding Standards 298
Guidelines for Placement of Curly Braces 299
Guidelines for Placement of else with Nested if Statements 299
Guidelines for Use of White Space with a Switch Statement 299
Spacing Conventions 300
Advanced Selection Statement Suggestions 300
Resources 300
Quick Review 301
Exercises 302
Programming Exercises 310

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xii | C# Programming: From Problem Analysis to Program Design, Fourth Edition

REPEATING INSTRUCTIONS 313


6 Why Use a Loop? 314
Using the While Statement 314
Counter-Controlled Loop 316
Sentinel-Controlled Loop 321
State-Controlled Loops 332
Using the for Statement Loop 335
Using the Foreach Statement 342
Using the Do...while Structure 343
Nested Loops 346
Recursive Calls 351
Unconditional Transfer of Control 354
Continue Statement 355
Deciding Which Loop to Use 356
Coding Standards 370
Guidelines for Placement of Curly Braces 371
Spacing Conventions 371
Advanced Loop Statement Suggestions 371
Resources 372
Quick Review 372
Exercises 373
Programming Exercises 379

ARRAYS 383
7 Array Basics 384
Array Declaration 385
Array Initializers 388
Array Access 390
Sentinel-Controlled Access 394
Using Foreach with Arrays 395
Array Class 396
Arrays as Method Parameters 401
Pass by Reference 401
Array Assignment 405
Params Parameters 406

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents | xiii

Arrays in Classes 408


Array of User-Defined Objects 410
Arrays as Return Types 410
Coding Standards 428
Guidelines for Naming Arrays 428
Advanced Array Suggestions 428
Resources 429
Quick Review 429
Exercises 430
Programming Exercises 437

ADVANCED COLLECTIONS 439


8 Two-Dimensional Arrays 440
Rectangular Array 440
Jagged Array 450
Multidimensional Arrays 450
ArrayList Class 455
String Class 459
Other Collection Classes 465
BitArray 466
Hashtable 467
Queue 469
Stack 470
Coding Standards 479
Guidelines for Naming Collections 479
Advanced Array Suggestions 479
Resources 479
Quick Review 480
Exercises 481
Programming Exercises 488

INTRODUCTION TO WINDOWS PROGRAMMING 493


9 Contrasting Windows and Console Applications 494
Graphical User Interfaces 496

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xiv | C# Programming: From Problem Analysis to Program Design, Fourth Edition

Elements of Good Design 500


Consistency 500
Alignment 500
Avoid Clutter 501
Color 501
Target Audience 501
Using C# and Visual Studio to Create Windows-Based
Applications 502
Windows Forms 505
Windows Forms Properties 505
Inspecting the Code Generated by Visual Studio 511
Windows Forms Events 515
Controls 517
Placing, Moving, Resizing, and Deleting Control Objects 520
Methods and Properties of the Control Class 521
Derived Classes of the System.Windows.Forms.Control Class 524
Coding Standards 567
Guidelines for Naming Controls 567
Resources 567
Quick Review 568
Exercises 569
Programming Exercises 574

PROGRAMMING BASED ON EVENTS 577


10 Delegates 578
Defining Delegates 578
Creating Delegate Instances 579
Using Delegates 580
Relationship of Delegates to Events 583
Event Handling in C# 583
Event-Handler Methods 584
ListBox Control Objects 585
Creating a Form to Hold ListBox Controls 585
ListBox Event Handlers 588
Multiple Selections with a ListBox Object 589
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents | xv

ComboBox Control Objects 601


Adding ComboBox Objects 602
Handling ComboBox Events 602
Registering a KeyPress Event 603
Programming Event Handlers 603
MenuStrip Control Objects 605
Adding Menus 606
Adding Predefined Standard Windows Dialog Boxes 610
CheckBox and RadioButton Objects 618
CheckBox Objects 618
Adding CheckBox Objects 619
Registering CheckBox Object Events 619
Wiring One Event Handler to Multiple Objects 621
GroupBox Objects 622
RadioButton Objects 622
Adding RadioButton Objects 622
Registering RadioButton Object Events 624
Windows Presentation Foundation (WPF) 633
TabControl Objects 639
Coding Standards 680
Resources 680
Quick Review 680
Exercises 682
Programming Exercises 688

ADVANCED OBJECT-ORIENTED PROGRAMMING


11 FEATURES 691
Object-Oriented Language Features 692
Component-Based Development 693
Inheritance 694
Inheriting from the Object Class 695
Inheriting from Other .NET FCL Classes 695
Creating Base Classes for Inheritance 696
Overriding Methods 699
Creating Derived Classes 700
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xvi | C# Programming: From Problem Analysis to Program Design, Fourth Edition

Making Stand-Alone Components 705


Creating a Client Application to Use the DLL 715
Using ILDASM to View the Assembly (Optional) 719
Abstract Classes 721
Abstract Methods 721
Sealed Classes 724
Sealed Methods 725
Partial Classes 725
Creating Partial Classes 726
Interfaces 726
Defining an Interface 727
Implementing the Interface 728
.NET Framework Interfaces 733
Polymorphism 734
Polymorphic Programming in .NET 736
Generics 737
Generic Classes 737
Generic Methods 741
Dynamic 742
Dynamic data type 743
var data type 744
Coding Standards 764
Resources 765
Quick Review 765
Exercises 767
Programming Exercises 772

DEBUGGING AND HANDLING EXCEPTIONS 775


12 Errors 776
Run-Time Errors 777
Debugging in C# 778
Exceptions 786
Raising an Exception 790
Bugs, Errors, and Exceptions 791

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Table of Contents | xvii

Exception-Handling Techniques 793


Try. . .Catch. . .Finally Blocks 794
Exception Object 798
Exception Classes 799
Derived Classes of the Base Exception Class 799
ApplicationException Class 800
SystemException Class 801
Filtering Multiple Exceptions 802
Throwing an Exception 809
Input Output (IO) Exceptions 810
Coding Standards 828
Resources 829
Quick Review 829
Exercises 830
Programming Exercises 835

WORKING WITH FILES 837


13 System.IO Namespace 838
File and Directory Classes 840
File Class 840
Directory Class 844
FileInfo and DirectoryInfo Classes 845
File Streams 848
Writing Text Files 851
Reading Text Files 856
Adding a Using Statement 860
Random Access 863
BinaryReader and BinaryWriter Classes 863
Other Stream Classes 869
FileDialog Class 870
Coding Standards 884
Resources 884
Quick Review 884
Exercises 885
Programming Exercises 890

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xviii | C# Programming: From Problem Analysis to Program Design, Fourth Edition

WORKING WITH DATABASES 893


14 Database Access 894
Database Management Systems 894
ADO.NET 895
Data Providers 896
Connecting to the Database 899
Retrieving Data from the Database 901
Processing the Data 905
Updating Database Data 913
Using Datasets to Process Database Records 913
Data Source Configuration Tools 921
Add New Data Source 921
Dataset Object 931
TableAdapterManager 941
DataSet Designer 942
Connecting Multiple Tables 953
Displaying Data Using Details View 959
Language-Integrated Query (LINQ) 962
Query Expressions 963
Implicitly Typed Local Variables 966
LINQ with Databases 966
LINQ to SQL 968
Coding Standards 969
Resources 969
Quick Review 969
Exercises 971
Programming Exercises 976

WEB-BASED APPLICATIONS 979


15 Web-Based Applications 980
Web Programming Model 980
Static Pages 981
Dynamic Pages 984

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Random documents with unrelated
content Scribd suggests to you:
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebooknice.com

You might also like