معرفی کتابهای زبانهای دات نت - سی شارپ - سی پلاس - وی بی دات نت

saalek110

Well-Known Member
معرفی کتابهای زبانهای دات نت - سی شارپ - سی پلاس - وی بی دات نت

در این تاپیک به مرور کتابهای دات نت معرفی می شود.

ایده آل آن است که در هر پست یک کتاب معرفی شود و نام و نویسنده و مندرجات و فهرست و کمی شرح داده شود
ولی به علت محدودیت بعضی به شکل سایت و بعضی کمی بیشتر لینک داده می شود.

شما هم در این تاپیک لینکها و مطالب مفید مربوط به این تاپیک را هر وقت فرصت داشتید بزنید.
 
آخرین ویرایش:

saalek110

Well-Known Member
اینجا یه سری کتاب توپ برای vcpp.net هست:
البته برای خیلی چیزای دیگه هم هست:

www.flazx.com

www.itebookhome.com

خوبی اولی اینه که بیشتر کتاباش به rapidshare نیاز نداره.

با تشکر.

---------------------------
درسته. تقریبا هر کتابی بخواهید اینجا پیدا میشه.

اینجا:
http://www.flazx.com/category126.php
قسمت
Visual C++ .NET
است که حدود 15 کتاب دارد. من زیاد این کتابها را نخواندم. چون بیشتر به سی شارپ توجه داشتم . برای اکثر زبانها کتابهای زیادی در این سایت هست.


Visual C# 2005 How to Program (2nd Edition
a3.gif

چون سایت وارز بود عکس لینک را گذاشتم. خودتان تایپ کنید.
باید اینجا ثبت نام کنید تا بتوانید مجانی دانلود کنید.
حجم : در حدود 28 مگا.


در سایت بالا که لینکش را به شکل عکس گذاشتم با ئی میل خود عضو شوید و هر وقت کتاب جدید بیاید لیست کتب جدید را برای شما ارسال می کند. سعی کنید با اکسپلورر بروید به این سایت تا در فرمها دچار مشکل نشوید.از سرچ سایت هم استفاده کنید.
 
آخرین ویرایش:

saalek110

Well-Known Member
به نقل از :
دنبال كتابهاي خفن هستي!!! بيا تو حال كن!!!( دانلود كن ) ‏
==========================

http://giuciao.altervista.org/free_books.html
کتابهای خوبی اینجا پیدا میشه ولی بعضی پسوردشان اشتباه است.



http://www.ghafaseh.com/search.php?sort=4,3,tarikh
در تاپیک اصلی گوینده گفته کتاب است ولی من نگشتم.


--------------------
http://www.gayanb.com/



Free computer books
Best free J2EE books
Best free .NET books
Best free XML books
Best free PHP books
Free Java books
Free J2EE books
Free JSP books
Free J2ME books
Free .NET books
Free C# books
Free ASP.NET books
Free VB.NET books
Free VS.NET books
Free Oracle books
Free Linux books
Free MySql books
More free books
Free MSDN Mags
Free Oracle Mags
Free software CDs​
 

saalek110

Well-Known Member
Pro Visual C++ /CLI and the .NET 2.0 Platform
1590596404.01.MZZZZZZZ.jpg

http://www.flazx.com/ebook4985.php

حجم pdf ئی که روی هارد من است 23 مگا است.

فهرست کتاب:

کد:
[SIZE="4"][B]Contents[/B][/SIZE]
Foreword by Stanley B. Lippman . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxi
About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxxiii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxv
[SIZE="3"][B]PART 1 ■ ■ ■ The C++/CLI Language[/B][/SIZE]
■[B]CHAPTER 1 Overview of the .NET Framework . . . . . . . . . . . . . . . . . . . . . . . . . . 3[/B]
What Is .NET? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
What Is the .NET Framework? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
.NET Programming Advantages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
A Closer Look at the .NET Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Assemblies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Common Language Runtime. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Common Type System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Common Language Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
.NET Application Development Realms . . . . . . . . . . . . . . . . . . . . . . . 21
.NET Framework Class Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
■[B]CHAPTER 2 C++/CLI Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27[/B]
The Obligatory “Hello World!” Program . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Variables and C++/CLI Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Declaring Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Variable Name Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Predefined Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
User-Defined Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Boxing and Unboxing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Type Modifiers and Qualifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Type Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Variable Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
viii ■CONTENTS
Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Numeric Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Boolean Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Character Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
String Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Comparisons and Logical Operators. . . . . . . . . . . . . . . . . . . . . . . . . . 62
Bitwise Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Conditional Operator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Comma Operator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Assignment Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Address of, Reference, and Indirection Operators . . . . . . . . . . . . . . 66
Operator Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Flow Control Constructs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
if Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
switch Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Looping Constructs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
while Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
do-while Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
for Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
for each Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Skipping Loop Iterations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Breaking Out of a Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Passing Arguments to a Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Returning Values from a Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Prototypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Function Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Passing Arguments to the main() Function . . . . . . . . . . . . . . . . . . . . 80
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
■[B]CHAPTER 3 Object-Oriented C++/CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85[/B]
Object-Oriented Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Inheritance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Applying Objects to Software Development. . . . . . . . . . . . . . . . . . . . 87
■CONTENTS ix
ref class/struct Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Declaring ref classes and structs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Using the ref class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Member Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Member Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Member Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Nested ref classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Type Casting Between Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Abstract ref classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
■[B]CHAPTER 4 Advanced C++/CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139[/B]
Preprocessor Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Defining Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Conditional Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Include Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Using Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Multifile Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Header Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Source Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Building Assemblies from Multifile Libraries . . . . . . . . . . . . . . . . . . 149
Assembly Referencing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Function Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Class Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Template Specialization and Partial Specialization. . . . . . . . . . . . . 159
Template Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Generics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
typedef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Basics of Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
.NET Framework Base Class: Exception Classes . . . . . . . . . . . . . . 168
Throwing ApplicationExceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Rethrowing Exceptions and Nested try Blocks . . . . . . . . . . . . . . . . 172
Catching Multiple Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Catching All Previously Uncaught Exceptions . . . . . . . . . . . . . . . . . 176
Executing Code Regardless of an Exception . . . . . . . . . . . . . . . . . . 177
x ■CONTENTS
Delegates and Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Delegates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
[SIZE="3"][B]PART 2 ■ ■ ■ .NET Framework Development
in C++/CLI[/B][/SIZE]
■[B]CHAPTER 5 The .NET Framework Class Library . . . . . . . . . . . . . . . . . . . . . . 193[/B]
Library Organizational Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Library Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
System::Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
System::Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
System::Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
System::Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
System::DirectoryServices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
System::Drawing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
System::EnterpriseServices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
System::Globalization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
System::IO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
System::IO::Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
System::Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
System::Net . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
System::Reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
System::Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
System::Runtime::InteropServices . . . . . . . . . . . . . . . . . . . . . . . . . . 208
System::Runtime::Remoting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
System::Runtime::Serialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
System::Security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
System::Threading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
System::Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
System::Windows::Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
System::Xml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Microsoft::Win32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
■CONTENTS xi
■[B]CHAPTER 6 Integrated XML Documentation . . . . . . . . . . . . . . . . . . . . . . . . . 217[/B]
The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
The Triple Slash Comment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Adding Triple Slash Comment to Your Code . . . . . . . . . . . . . . . . . . 219
Generating XML Documentation Files . . . . . . . . . . . . . . . . . . . . . . . 220
Viewing Integrated XML Documentation in IntelliSense . . . . . . . . . 222
Documentation Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Functionality Tags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Formatting Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Reference Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Documentation Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
■[B]CHAPTER 7 Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241[/B]
IEnumerable, IEnumerator, and for each . . . . . . . . . . . . . . . . . . . . . . . . . 243
Standard Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
ArrayList. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
BitArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Hashtable and SortedList. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Queue and Stack. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Specialized Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
ListDictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
StringCollection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
StringDictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
NameValueCollection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Generic Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
List<T> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
LinkedList<T>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Queue<T> and Stack<T>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Dictionary<K,V>, SortedDictionary<K,V> . . . . . . . . . . . . . . . . . . . . 273
Collection<T> and ReadOnlyCollection<T> . . . . . . . . . . . . . . . . . . 278
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
■[B]CHAPTER 8 Input, Output, and Serialization . . . . . . . . . . . . . . . . . . . . . . . . . 279[/B]
File System Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Managing the File System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Opening Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
The Open Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
I/O Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
xii ■CONTENTS
Serialization of Managed Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Setting Up Classes for Serialization . . . . . . . . . . . . . . . . . . . . . . . . . 302
BinaryFormatter vs. SoapFormatter . . . . . . . . . . . . . . . . . . . . . . . . . 304
Serialization Using BinaryFormatter . . . . . . . . . . . . . . . . . . . . . . . . . 304
Serialization Using SoapFormatter . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
■[B]CHAPTER 9 Basic Windows Forms Applications . . . . . . . . . . . . . . . . . . . . . 309[/B]
Win Forms Are Not MFC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
“Hello World!” Win Form Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Customizing the Form Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Handling Win Form Delegates and Events . . . . . . . . . . . . . . . . . . . . . . . . 319
Adding Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
The Label Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
The Button Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
The Text Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
The Selection Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
■[B]CHAPTER 10 Advanced Windows Forms Applications . . . . . . . . . . . . . . . . 377[/B]
ImageList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
ListView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
TreeView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
Container Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
TabControl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
SplitContainer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Strips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
ToolStripContainer and ToolStripPanel. . . . . . . . . . . . . . . . . . . . . . . 402
ToolStripManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
ToolStrip. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
StatusStrip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
MenuStrip and ContextMenuStrip. . . . . . . . . . . . . . . . . . . . . . . . . . . 414
Bells and Whistles Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
PictureBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
MonthCalendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
ErrorProvider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
NotifyIcon. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
■CONTENTS xiii
Dialog Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
Custom Dialog Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
Common .NET Framework–Provided Dialog Boxes . . . . . . . . . . . . 442
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
■[B]CHAPTER 11 Graphics Using GDI+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445[/B]
What Is GDI+? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
A Quick Look at the GDI+ Namespaces . . . . . . . . . . . . . . . . . . . . . . 446
“Hello World!” GDI+ Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
OnPaint vs. PaintEventHandler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
The Graphics Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
Graphics Class Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
Disposing of Resources with Deterministic Cleanup . . . . . . . . . . . 455
Rendering Outside of the Paint Event . . . . . . . . . . . . . . . . . . . . . . . . 455
The Invalidate Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
GDI+ Coordinate Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Common Utility Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
Point and PointF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
Size and SizeF. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464
Rectangle and RectangleF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
Drawing Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
Custom Colors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Named Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Pens and Brushes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Pens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Brushes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
Rendering Prebuilt Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
Drawing Your Own Shapes and Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . 492
Advanced GDI+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
Scrollable Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
Optimizing GDI+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498
Double Buffering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501
Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513
xiv ■CONTENTS
■[B]CHAPTER 12 ADO.NET and Database Development . . . . . . . . . . . . . . . . . . . 515[/B]
What Is ADO.NET? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
Building a Database with Visual Studio 2005 . . . . . . . . . . . . . . . . . . . . . 517
Creating a New Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
Adding and Loading Tables and Views to a Database . . . . . . . . . . 519
Building Stored Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
Managed Providers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526
Connected ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
Using Simple Connected ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . 527
Using Connected ADO.NET with Transactions. . . . . . . . . . . . . . . . . 539
Disconnected ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544
The Core Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544
Creating a Table Manually in Code . . . . . . . . . . . . . . . . . . . . . . . . . . 548
Developing with Disconnected ADO.NET . . . . . . . . . . . . . . . . . . . . . 549
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
■[B]CHAPTER 13 XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559[/B]
What Is XML? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
The .NET Framework XML Implementations . . . . . . . . . . . . . . . . . . . . . . 560
Forward-Only Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
Reading from an XML File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562
Validating an XML File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
Writing a New XML Stream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
Updating an Existing XML File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578
Working with DOM Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581
Reading a DOM Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
Updating a DOM Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588
Writing XmlNodes in a DOM Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . 590
Navigating with XPathNavigator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
Basic XPathNavigator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594
XPathNavigator Using XPath Expressions . . . . . . . . . . . . . . . . . . . . 596
XML and ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603
■CONTENTS xv
■[B]CHAPTER 14 Windows Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605[/B]
What Are Windows Services? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605
Architecture of Windows Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
Service Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
Service Control Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
Service Configuration Application . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
The ServiceProcess Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609
Creating Windows Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609
Auto-generated Windows Service. . . . . . . . . . . . . . . . . . . . . . . . . . . 610
Customizing the Windows Service . . . . . . . . . . . . . . . . . . . . . . . . . . 615
Installing and Uninstalling Windows Services . . . . . . . . . . . . . . . . . . . . . 621
Managing Windows Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624
Services Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625
Custom Service Control Application . . . . . . . . . . . . . . . . . . . . . . . . . 626
Debugging Windows Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630
Attaching the Debugger to the Windows Service . . . . . . . . . . . . . . 631
A Special Main() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634
■[B]CHAPTER 15 Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635[/B]
What Are Web Services? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
Components of a Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
Communication Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
Description Service. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637
Discovery Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637
The Web Services Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
A Simple Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
Accessing a Web Service Using HTTP POST . . . . . . . . . . . . . . . . . . 646
Accessing a Web Service Using SOAP . . . . . . . . . . . . . . . . . . . . . . . 647
Debugging a Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 650
Passing Data Using a Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651
Using Web Service GUI Designer Tool . . . . . . . . . . . . . . . . . . . . . . . 652
Returning a DataSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653
Inserting, Updating, and Deleting Rows in a DataSet . . . . . . . . . . . 654
Authors DataSet Processing Web Service Client. . . . . . . . . . . . . . . 655
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659
xvi ■CONTENTS
■[B]CHAPTER 16 Multithreaded Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661[/B]
What Is Multithreaded Programming? . . . . . . . . . . . . . . . . . . . . . . . . . . . 661
Basic .NET Framework Class Library Threading . . . . . . . . . . . . . . . . . . . 662
Thread State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663
Thread Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665
Using Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666
Starting Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666
Getting a Thread to Sleep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669
Aborting Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671
Joining Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673
Interrupting, Suspending, and Resuming Threads . . . . . . . . . . . . . 675
Using ThreadPools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679
The ThreadStatic Attribute. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680
The Interlocked Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682
The Monitor Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684
The Mutex Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687
The ReaderWriterLock Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694
■[B]CHAPTER 17 Network Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695[/B]
The Network Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695
Connection-Oriented Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696
The TCP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696
The TCP Client. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702
Connectionless Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705
UDP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706
UDP Client Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710
Using Connect() with UDP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
Socket Helper Classes and Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712
TcpListener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712
TcpClient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713
TCP Helper Class Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714
UdpClient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717
Changing Socket Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719
■CONTENTS xvii
Asynchronous Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720
Accepting Connections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721
Connecting to a Connection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722
Disconnecting from a Connection. . . . . . . . . . . . . . . . . . . . . . . . . . . 723
Sending a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724
Receiving a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724
Asynchronous TCP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728
■[B]CHAPTER 18 Assembly Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729[/B]
Reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729
Examining Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730
Dynamically Invoking or Late-Binding Objects . . . . . . . . . . . . . . . . 735
Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738
Creating a Custom Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739
Implementing a Custom Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . 742
Using a Custom Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743
Shared Assemblies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746
The Global Assembly Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746
Adding Assemblies to the GAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747
The Shared Assembly’s Strong Name . . . . . . . . . . . . . . . . . . . . . . . 748
Re-signing an Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749
Signcoded Digital Signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749
Versioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749
No DLL Hell Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751
Application Configuration Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754
Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755
Creating Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756
Embedding Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758
Accessing Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 762
Globalization and Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 764
The Globalization Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 765
The Localization Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 767
Building a Multicultural Windows Application . . . . . . . . . . . . . . . . . 767
Building a Multicultural Console Application . . . . . . . . . . . . . . . . . . 770
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773
xviii ■CONTENTS
■[B]CHAPTER 19 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775[/B]
The Security Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775
Role-Based Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 776
Identities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 776
Principal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 777
Working with Identities and Principals . . . . . . . . . . . . . . . . . . . . . . . 778
Securing Your Code Using Roles. . . . . . . . . . . . . . . . . . . . . . . . . . . . 780
Code Access Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783
Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783
Policy Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 784
Code Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785
Evidence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790
Securing Your Code Using CAS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802
[SIZE="3"][B]PART 3 ■ ■ ■ Unsafe/Unmanaged C++/CLI[/B][/SIZE]
■[B]CHAPTER 20 Unsafe C++ .NET Programming . . . . . . . . . . . . . . . . . . . . . . . . . 805[/B]
What Is Unsafe Code? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805
Why Do We Still Need Unsafe Code? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806
Creating Unsafe Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 807
The Managed and Unmanaged #pragma Directives. . . . . . . . . . . . 807
Unmanaged Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810
Unmanaged Classes/Structs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811
Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 815
Including the vcclr.h File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 823
■[B]CHAPTER 21 Advanced Unsafe or Unmanaged[/B]
C++ .NET Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 825
P/Invoke . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 825
Calling DLLs without P/Invoke. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 826
Using P/Invoke . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 828
Data Marshaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 833
MarshalAsAttribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 833
Marshaling Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835
Marshaling Ref and Value Classes . . . . . . . . . . . . . . . . . . . . . . . . . . 835
■CONTENTS xix
Accessing COM Components from .NET . . . . . . . . . . . . . . . . . . . . . . . . . 837
Interop Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839
Creating the Interop Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839
Invoking the Interop Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841
Handling COM Object Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843
Late Binding a COM Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 844
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 846
■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 847
 
آخرین ویرایش:

saalek110

Well-Known Member
http://vcheck.emule-project.net/en/download.php?language=1033
لینک دانلود امول.

نرم افزاری برای تبادل فایل . چیزهای نایاب به راحتی پیدا می شود.
من خودم یک کتاب دانلود کردم. کلا نرم افزار مفیدی است. توضیحات بیشتر را کسانی که بیشتر کار کرده اند خواهند داد.
 
آخرین ویرایش:

elham_rashid

New Member
سی پلاس دات نت یا سی شارپ

سلام ميخواستم بدونم تفاوت ويژوال سي ++ با ويژوال سي net.++ در چيه؟و يك كتاب خوب وسريع در مورد سيnet.++ معرفي كنيد.
 

saalek110

Well-Known Member
با سلام.
ویژوال سی 6 جزو ویژوال استودیو 2000 است. به همراه ویژوال بیسیک 6 و چند تای دیگه.
در ورژن های بعدی ویژوال استودیو یعنی 2003 و 2005 اتفاقاتی روی داد که کمی شرحش مضر نیست.

میکروسافت می خواست فریم ورک خودش را عرضه کند.
با عرضه این فریم ورک تمام برنامه ها با هر زبانی که ساخته شده بودند روی دات نت فریم ورک اجرا می شدند.
عده ای می گویند برای رقابت با جاوا بوده که در جاوا برنامه ها روی جاوا ویرچوال ماشین اجرا می شود.

اما می گویند که با این سیستم جدید زبانها بهم نزدیک می شوند.
می گویند وی بی 6 در وی بی دات نت جان تازه ای گرفت .
ولی وی سی 6 چه؟

میکروسافت نتوانست تکنولوژی مبتنی بر mfc را با تکنولوژی دات نت مخلوط کند.(نظر شخصی)
حالا یا می ترسید صدای mfc کارها دربیاید یا اصلا با فلسفه دات نت جور نبود. چون برنامه های وی سی 6 (با mfc) مستقلند و نیازی به دات نت فریم ورک ندارند.
پس میکروسافت آمد در ویژوال سی 2003 و 2005 یک قسمتی را هم برای نوشتن برنامه های mfc اختصاص داد.
البته علاوه بر پروژه mfc نوع win32 هم داریم. در win32 فکر کنم(؟) از api های خود ویندوز استفاده می شود.
کلاسهای mfc با داشتن آپشنی قابل اضافه کردن به برنامه اجرایی است. مثل کلاسهای vcl که در برنامه های دلفی به فایل اجرایی اضافه می شود.
ولی در دات نت آپشنی وجود ندارد.
شما از کلاسهای دات نت اضافه می کنید و کلاسها هم در دات نت فریم ورک است نه در برنامه شما. و اگر هم کلاسها را اضافه کنید باز هم اصلا برنامه شما واقعا یک فایل اجرایی نیست. چون به clr نیاز دارد برای اجرا(بر اساس شنیده ها در سایت های فارسی)
شاید کسی بگوید کلاسهای دات نت خیلی کامل است و هر سال هم بروز می شود. من خودم برنامه نویسی نیستم که بدانم این کلاسها چقدر کامل است.

----------------
حالا سئوالات من:
شما چه تکنولوژی ئی را انتخاب می کنید؟
mfc
dot net

ولی در پاسخ دادن به این سئوال نکته دیگری هم هست و آن دیگر به دو مسئله زیر یعنی:
قدرت و وسعت و کاملی کلاسها.
افزوده شدن یا نشدن کلاسها.

مربوط نمی شود.
بلکه مربوط به سرعت ساخت برنامه است.
در دات نت شما ساخت سریع نرم افزار را دارید. همان RAD . یعنی رپید اپلیکیشن دیزاین.
ولی در وی سی 6 با Mfc شما این را ندارید. و پیچیدگی های بیشتری پیش روی شماست.

کلا در دات نت همه چیز رند است. زبانهای وی بی دات نت - سی شارپ - سی پلاس همگی با کلاسهای دات نت کارهایشان را انجام می دهند و براحتی قابل تبدیل به هم هستند.
سئوالی اینجا مطرح است که آیا قدرت وی بی دات نت با بقیه یا سی شارپ با بقیه برابر است؟ من جواب این سئوال را نمی دانم ولی اگر برابر بود به شما می گفتم ....
اگر می خواهید دات نت کار کنید چرا سی شارپ کار نمی کنید. اگر قدرتها برابر است چرا سینتکس رند سی شارپ را انتخاب نمی کنید . و اگر قبلا وی بی 6 کار کرده اید چرا وی بی دات نت کار نمی کنید؟

و در سئوال بالا اگر بین mfc و یا win32 و از آنسو دات نت شما آمدید دات نت را انتخاب کردید. و باز بر وِِیژوال سی ++ دات نت (علی رغم وجود سی شارپ و وی بی دات نت) مصر بودید... سئوالی که پیش می آید این است که 2003 می خواهید کار کنید یا 2005 ؟
چون من با یکی دو برنامه که نوشتم دیدم سینتکس کمی تغیییر کرده.
البته شاید تفاوت سینتکس کم باشد ولی اگر یک مبتدی کتاب 2005 دست بگیرد و کامپایلر 2003 باز کند می تواند دچار ساعتها درگیری یا بدتر از آن نرسیدن به تفاوت سینتکس و اجرا نشدن برنامه بشود.
پس ورژن هم مهم است.
پس خلاصه سئوالات :
کدام تکنولوژی ؟
کدام زبان؟
کدام ورژن؟

اما پیشنهاد من . یک کتاب آموزش در 24 ساعت . با حجم کوچک انتخاب کنید و تمام برنامه هایش را اجرا کنید. این طوری شما می شوید یک برنامه نویس . و بعد با کتابهای دیگر تمرینات خود را بیشتر کنید.
فارسی که کتاب خیلی کم است(منظورم در اینترنت است) ولی ئی بوک انگلیسی زیاد است.
در حل تمرینات هر مشکلی داشتید بگویید. البته من با سینتکس سی شارپ همه تمریناتم را انجام داده ام ولی راحت قابل تبدیل است.
 
آخرین ویرایش:

elham_rashid

New Member
با سلام
لطفا فرق بين vc++.netو #cو c#.netرا توضيح دهيدوبه نظر شما من چه زباني را شروع به ياد گيري كنم و در مورد ان يك كتاب خوب وسريع معرفي كنيد
با تشكر
 

saalek110

Well-Known Member
سلام.
زبانهای دات نت زیاد فرقی با هم ندارند. من وقتی می خواستم بین سی + دات نت و سی شارپ یکی را انتخاب کنم .....
نقل از :
http://forum.majidonline.com/showthread.php?t=62077
سلام.

سوم اينكه كلا ويژوال سي شارپ دات نت چه فرقي با ويژوال سي پلاس دات نت داره؟ آيا فقط سينتكسش فرق داره؟ چرا اين سينتكس جديد ايجاد شده پس؟ شنيدم كه براي رفع سختي هاي سي. فقط همينه؟ من قبلا سي پلاس داسي كار كرده ام. آيا يادگيري ويژوال سي پلاس باعث صرفه جويي بيشتر براي من ميشه يا ويژوال سي شارپ؟ يعني براي طراحي برنامه هاي مبتني بر دات نت كدام براي من راحت تره؟

شما بهترین کاری که می تونی انجام بدی یاد گیری سی شارپ دات نت شما با اسمبلی هم هر برنامه ای که فکرش رو بکنی می تونی بنویسی اما این یه محیط آمادس و راحت شما می تونی با کد نویسی تو هر محیطی انیمیشنای کارتون شرک یا هر چی رو درست کنی اما وقتی 3D-MAX یا امسالش هس این کار رو می کنی؟محیط آماده با حد اکثر امکانات که قبلا روش کلی فکر شده اگه خودت این کار رو بکنی شاید اون استراتژی هایی که اون تیم برنامه نویسی به ذهنشون اومده و حالا فقط به صورت یه ابزار راحت در اختیارت هست رو به ذهنت نیاد یا حداقل وقت گیر باشه

و نقل از :
http://forum.iranled.com/showthread.php?tid=4058
برای برنامه نویسی گرافیکی و بازی سیشارپ یا سی پلاس پلاس .چرا؟

Programmer:

دوست عزیز به من اعتماد کن هیچ فرقی نداره من هم در C++ و هم در C# دها هزار خط برنامه گرافیک 3 بعدی نوشتم با DirectX, OpenGL, این چیزا هیچ فرقی نداره C# خیلی هم خوش قلق تره!! باور کن!! من امتحان کردم بعد از یه عمر تجربه می گم!!!

سینتکس سی شارپ رند است. خیلی شبیه وی بی دات نت . البته از نظر عملگرها(شرح در پاراگراف بعدی) . ولی کروشه و سمی کلونش شبیه سی است.

البته در سی پلاس دات نت فقط میشه unsafe نوشت . یعنی همان سی قدیمی. مثل اشاره گر و غیره. ولی در دات نت کلا کارها با گاربیج کالکتوره. که حافظه ها را آزاد می کند. در سی پلاس از :: (کلاس و فضا) و فلش -> برای متد شی استفاده می شود. در سی شارپ همه مثل وی بی دات نت نقطه استفاده می شود.

اگر می خواهید سی شارپ شروع کنید می توانید از تاپیک یادگیری سی شارپ شروع کنید.
یا از کتاب آقای هاشمیان شروع کنید. لینک دانلودش در همان صفحه دوم تاپیک یادگیری سی شارپ است.
و اگر انگلیسی می خواهید از کتاب sams شروع کنید.

0672327406.01.MZZZZZZZ.jpg

http://www.flazx.com/ebook5325.php
من از همین لینک دانلود کردم
Sams.Teach.Yourself.Visual.C.Sharp.2005.in.24.Hours.Complete.Starter.Kit.May.2006
تا مطمئن شوم. 3 تکه بود که یکی کردم و دوباره آپلود کردم اینجا:
http://rapidshare.com/files/34676872/sams_sharp2005_in24hours.rar.html
البته بعد چند ماه اگر دانلود نشود این لینک حذف می شود و به لینک بالا مراجعه کنید.
چند فصل کتاب را استاد گرامی UNIQUE ترجمه کرده در اینجا:
http://forum.majidonline.com/showthread.php?t=62666&page=3
البته ممکن است کتاب مورد ترجمه ویژوال سی شارپ 2003 باشد که این کتاب را من در هاردم داشتم آپلود کردم.
http://rapidshare.com/files/34755509/sams_csharp2003_in24hours.rar.html

c2.gif


بعدش هم کتابهای دیگه را بخوانید و تمرین کنید:
http://www.flazx.com/category3.php

جمله آخر:
من چند روزه دارم با سی پلاس دیتابیس کار می کنم ولی هیچ کتاب و منبعی در اختیار ندارم. دهها کتاب کار با دیتابیس دارم که یا به سی شارپه یا وی بی دات نت. فقط به شیوه ور رفتن و خطا و آزمون دارم می رم جلو. خلاصه کلام اینکه منابع شاید خیلی مهم تر باشه از فاکتورهای دیگر.

بحث کلی:

این برای من هم سئوال بود. و هست.
من پیش خودم می گفتم سی پلاس کار باید برود سی پلاس دات نت.

ولی به نظرم برو سمت سی شارپ .
چون منابع آن زیاده. سینتکسش هم رند است. می دانید که میکروسافت زبان سی شارپ را مخصوص دات نت طراحی کرده.
یک چیزی می گم که دلیلی برای درستی اش ندارم. و جایی هم چیزی راجع بهش نخوندم ....... به نظر من اصلا سی پلاس با دات نت جور در نمی آید.... در سیستم دات نت همه چیز تحت اختیار کلاسهای دات نت است ولی در سی پلاس کنترل همه کامپیوتر دست برنامه نویس است. چطوری این دو تا با هم جور درمیاد. .. در حقیقت اون سی شارپ هم سی نیست. فقط سینتکسش سی است. شما در محدوده دات نت با کلاسهای دات نت طرفی حالا با هر زبان(سینتکس) که بنویسی. پس باید تکنولوژی دات نت را نقد کرد سینتکس ها همه ظاهری و صوری است.
البته میگم این حرفم را از جایی و مستند نمی زنم ولی به این حس رسیده ام.
البته ممکنه کسی بگه شما می توانی unsafe بنویسی در سی پلاس دات نت یا یک جورایی برنامه های سی استاندارد را وصل کنی به دات نت. ولی من میگم بله این ایده آل خوبی است . نمی دانم کسی این کار را می کند یا نه. البته به نظرم خیلی خوبه که آدم کارهای راحت را با کلاسهای دات نت انجام بدهد و کارهای سخت(غیر روتین) را با سی پلاس(به صورت مستقل و وصل شده به برنامه اصلی). البته من از این کارها تابحال نکردم و کلاسهای دات نت را هنوز مسلط نشده ام تا بروم دنبال این جور کارها. اصلا در نوشتن برنامه های ساده شاید این جور کارها اصلا نیاز نشود. مگه کلاسهای دات نت چی کم داره. برای هر کاری کلاسهایی پیش بینی کرده. شایدم چیزایی باشه که در کلاسهای دات نت پیش بینی در آن نشده باشد ولی اون کارها دیگه خیلی باید غیر روتین باشد. الان چیزی به ذهنم نمی رسد.

بحث تکمیلی: به نظر من نگاه یک سی پلاس کار با نگاه یک دات نت کار متفاوت است.

در سی پلاس ما یاد گرفته ایم که همه چیز بیت و بایت است. سی پلاس قرابت زیادی با زبان اسمبلی دارد.
ولی در دات نت اول شما همه چیز را محدود می کنید و بعد دریچه ها را باز می کنید. در سی پلاس عکس این روند جریان دارد. مثلا در سی پلاس به یک متغیر هر عددی می شود داد و بعد با انوم و کلاس و اینها محدود می کنید رنج را.
در دات نت می گیم مدیریت حافظه در اصل متعلق به گربیج کالکتوره. ولی در گامهای بعدی کلاسی موجود است که نابودی شی را خودمان به عهده بگیریم.

در کل در سی پلاس شما بی قید و آزادید و بعد با ساختارهایی خود را محدود می کنید و دیوار می سازید.
در دات نت اول شما محبوسید در کلاسهای دات نت و بعد باید از لابلای دیوارها(همین کلاسهای دات نت ) ... توسط خود کلاسهای دات خود خود را خارج کنید.

کلا در دات نت شما اول داخل چهارچوبید بعد راهی برای خروج پیدا می کنید. ولی در سی پلاس اولش کاملا آزادید و بعد برای خود چهارچوب می سازید. مثل همان سی که با سی پلاس شی گرا شد. ولی در دات نت از اول کار شی گرا شروع می کنید. در دات نت یک متغیر هم شی ئی از کلاس System است نه چند بایت در Ram که شما بدانید در کدام قسمت Ram است.

===================

یکی از اساتید راجع به تکنولوژی های جدید صحبت کرد که من زیاد نفمیدم ولی دو لینک که داد را در زیر می آورم تا اینجا محفوظ باشد.

http://msdn2.microsoft.com/en-us/vstudio/aa700830.aspx
http://www.microsoft.com/downloads/...3B8-A360-A1C2BD6A421B&displaylang=en#filelist
 
آخرین ویرایش:

saalek110

Well-Known Member
c-net-illuminated_7798_125.jpg

C#.NET Illuminated
حجم: 11 مگا

فهرست:
کد:
[B]Chapter 1 Introduction 1[/B]
Event-Driven Programming 1
Windows Applications 2
Using a Database 4
Web Applications 5
Web Services 6
Mobile Applications 6
Crystal Reports 7
Computing with C# 8
Hardware 8
Software 9
History 10
Features 12
Visual Studio .NET 12
Summary 14
[B]Chapter 2 Creating an Application 15[/B]
Creating a Windows Application 15
The Start Page 15
Creating a Project 16
The Properties Window 17
Changing Properties 18
Adding Controls 19
The Toolbox 19
TextBox 20
Label 21
Code for an Event 22
IntelliSense 23
Running an Application 24
Closing the Project 25
Test Your Understanding 25
Positioning and Sizing Controls 25
Anchoring 27
Aligning Text 28
Docking 31
Moving and Sizing Controls 33
Using a Button 34
Setting Properties 35
Handling the Click Event 37
Context-Sensitive Help 37
Summary 38
Programming Exercises 39
[B]Chapter 3 Controls for Windows Forms 41[/B]
Using Radio Buttons and Link Labels 41
Radio Buttons 41
Adding a Link 45
Grouping Radio Buttons 47
Adding Another Group 51
More Boxes 52
Picture Boxes 52
Check Boxes 53
List Boxes 58
Combo Boxes 61
Keeping Track 62
DateTimePicker 63
NumericUpDown 65
Enabling the Display 65
StatusBar 66
Timer 66
Menus and Dialogs 68
MainMenu 68
RichTextBox 70
File Dialogs 72
A Print Dialog 75
A Color Dialog 75
A Font Dialog 77
Summary 78
Programming Exercises 79
[B]Chapter 4 Variables and Types 81[/B]
Variables and the Assignment Operator 81
Identifiers 81

Keywords 82
The Character Set 82
Variables 82
The Assignment Operator 83
Illustrating Variables 84
Constants 87
Types 87
Formatting 89
Format Specifiers 90
Field Width 92
Operators and Expressions 96
Precedence of Arithmetic Operators 97
Increment and Decrement Operators 99
Relational Operators and Expressions 100
The AND, OR, and NOT Operators 101
Conditional AND 101
Conditional OR 102
Logical Complement 102
Operator Precedence 103
Combining AND with OR 103
Summary 106
Programming Exercises 107
[B]Chapter 5 Selection and Repetition 109[/B]
The if and if-else Statements 110
The if Statement 110
The if-else Statement 111
Blocks 112
Nested ifs and the switch Statement 116
Nested if Statements 117
Pairing else with if 119
The switch Statement 122
Repetition 126
The while Statement 126
Loop Termination 127
The for Statement 128
The do Statement 133
Summary 136
Programming Exercises 137

[B]Chapter 6 Reference Types 140[/B]
Arrays 140
Multiple ListBox Selections 141
Using the Documentation 142
A CheckBox Array 143
A Search Game 144
Random Numbers 145
Array Variables and Values 148
Strings 150
Visualizing a String 150
Creating a String 151
A String Property 152
A String Indexer 152
String Methods 152
Overloaded Methods 154
Class Methods 156
Using StringBuilder 158
Library Classes 162
Namespaces 162
Control Objects 163
Summary 164
Programming Exercises 165
[B]Chapter 7 Using a Database 170[/B]
The Northwind Database 170
Relational Databases 170
Queries 171
The Connected Model 173
Connecting to a Database 173
Building a Command 175
Reading and Displaying the Data 176
The Disconnected Model 179
The Data Adapter Configuration Wizard 180
A Query Builder 181
A Data Set 182
Using the Data Form Wizard 183
Using Multiple Tables 187
Building the Query 188
Displaying the Query Results 190

Summary 192
Programming Exercises 191
[B]Chapter 8 Web Applications 195[/B]
HTML 196
Some HTML Tags 196
Web Server Controls and Code Behind 200
Hosting a Web page 200
Server Controls 202
Code Behind 202
More Web Controls 204
Accessing a Database 208
Adding a Connection 209
Configuring a Command 209
Displaying in a DataGrid 209
Writing the Event Handler 210
Choosing Data to Display 211
Using Multiple Web Forms 216
Redirecting a Response 216
The AutoPostBack Property 217
Adding a Web Form to a Project 218
Initializing the Page 219
Hidden State 220
Initializing the Page 223
Summary 224
Programming Exercises 225
[B]Chapter 9 Validation Controls 227[/B]
Checking Required Fields 227
Range Checking 231
String Values 232
Integer Values 233
Dates 233
Currency 234
Comparing Values 235
Client-Side Versus Server-Side Validation 237
Validating Expressions and Summarizing 239
Validating Expressions 239

Summarizing Validation Errors 243
Summary 244
Programming Exercises 244
[B]Chapter 10 XML 247[/B]
XML and Its Syntax 247
The Limitations of HTML 247
XML Syntax 248
Schemas 251
Building a Schema in Visual Studio .NET 252
Valid Documents 255
Using a Schema to Create an XML Document 256
From Data to XML 258
Northwind Data to XML 258
The Document Object Mode (DOM) 260
Processing an XML Document 261
Transforming XML 263
XSLT (Extensible Stylesheet Language for
Transformations) 263
Summary 272
Programming Exercises 273
[B]Chapter 11 Web Services 276[/B]
Web Service Clients 276
Adding a Web Reference 276
Asynchronous Calls 279
The Event Handler and the Callback Methods 280
Creating a Web Service 282
Testing the Web Service 284
A Client for the Reverse Service 285
Accessing Data 286
Creating the Web Service 286
Creating a Client 290
Summary 292
Programming Exercises 292

[B]Chapter 12 Mobile Applications 295[/B]
Introduction 295
Mobile Devices 295
Operating Systems 296
The .NET Compact Framework 297
Mobile Web Applications 298
A Simple Mobile Web Application 301
Creating a Web Application 301
The Windows CE .NET Emulator 302
The Pocket PC 2002 Emulator 304
A Smart Device Application: Appointment List 306
Using Tabs 307
Saving the Appointment List 309
Initializing the Appointment List 310
Accessing Web Services 311
Adding Web References 313
Summary 315
Programming Exercises 316
[B]Chapter 13 Crystal Reports 317[/B]
Creating a Simple Report 317
Adding and Creating a Report 317
Viewing the Report 320
Filtering 321
Adding Features to a Report 323
The Data Tab 323
The Fields Tab 324
The Group Tab 325
The Total Tab 325
The Remaining Tabs 326
Viewing the Report 326
Reports via the Web 327
Viewing a Report in a Web Form 327
A Web Service Report 328
Accessing the Web Service 329
Summary 330
Programming Exercises 330

Appendix A C# Keywords 331
Appendix B Operator Precedence Table 332
Appendix C The ASCII Character Set 333
Answers to Odd-Numbered Test Your Understanding Exercises 337
Index 343


microsoft-r-sql-server-2005-unleashed_7809_125.jpg

Microsoft(R) SQL Server 2005 Unleashed
حجم: 38 مگا

فهرست:
کد:
Contents at a Glance
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Part I Welcome to Microsoft SQL Server
1 SQL Server 2005 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2 What’s New in SQL Server 2005. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Part II SQL Server Tools and Utilities
3 SQL Server Management Studio. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
4 SQL Server Command-Line Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5 SQL Server Profiler. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Part III SQL Server Administration
6 SQL Server System and Database Administration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
7 Installing SQL Server 2005 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
8 Upgrading to SQL Server 2005 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
9 Client Installation and Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
10 Security and User Administration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
11 Database Backup and Restore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
12 Database Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
13 SQL Server Scheduling and Notification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
14 SQL Server High Availability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
15 Replication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
16 Database Mirroring. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
17 SQL Server Clustering. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
Part IV Database Administration
18 Creating and Managing Databases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
19 Creating and Managing Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579
20 Creating and Managing Indexes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623
21 Implementing Data Integrity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
22 Creating and Managing Views in SQL Server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667
23 Creating and Managing Stored Procedures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
کتابها را در سایت pdfchm دات کام پیدا کنید.
 
آخرین ویرایش:

saalek110

Well-Known Member
نقل از :
http://www.barnamenevis.org/forum/showthread.php?t=37949
--------------------------------------------------------------
یک کتاب راهنمای مفید سی شارپ برای تازه کارها
C# Pocket Reference
این کتاب یک راهنمای سریع درباره عناصر زبان سی شارپ ارائه داده است
شامل کلاسهای مفید دات نت فریم ورک بوده و مطالب دیگر که به نظر بنده کتاب جمع و جور و مفیدی می باشد مخصوصا برای افرادی که با این زبان تازه آشنا شده و می خواهند مطلبی را احیانا اگر فراموش کرده اند سریع بررسی کنند
اندازه فایل ضمیمه شده تنها حدود 140 کیلو بایت است.
تشکرها:
چیز جالبی بود دستت درد نکنه
ممنون جالب بود
ممنون تا باشه از این کتابها باشه دستت ندرده
ممنون بازم از اين كارا بكن
متشکرم امیدوارم همیشه موفق باشید
ممنون جالب بود

http://saalek110.250free.com/gifs2/a3/csref.zip
 

saalek110

Well-Known Member

b6.gif


کلا من از این کتاب راضیم . به نظرم خیلی نکات کاربردی و مفید دارد.

حجم مورد دانلود : حدود 7 مگا.
حجم فایل آنزیپ شده : حدود 9 مگا.

لینک دانلود:
http://rapidshare.com/files/34294796/Prf_ADO_Net_Prg.rar.html
از هارد آپلود کردم. اگر بعد چند ماه دیلت شد و گفت file not found در تاپیک پست نزنید. با پیام خصوصی بگید تا دوباره آپلود کنم. روی CD کتابهای آپلود شده را رایت کردم تا سریعا قابل دسترس باشد.
فهرست:
کد:
Table of Contents
Introduction 1
What Is ADO.NET? 1
What Does This Book Cover? 1
Who Is This Book For? 3
What You Need To Use This Book 3
Conventions 3
Customer Support 4
How to Download the Sample Code for the Book 4
Errata 4
E- mail Support 4
p2p.wrox.com 5
Why this System Offers the Best Support 6
Chapter 1: Data Access and .NET 9
The .NET Framework 9
The Common Language Runtime 10
Garbage Collection 11
The Common Language Infrastructure 11
Assemblies 11
The Common Type System 12
The Common Language Specification 12
.NET Class Libraries 12
Not Another Data Access Technology? 13
Brief History of Data Access 13
ODBC 13
DAO 13
RDO 14
OLE DB 14
ADO 14
Introduction to ADO.NET 15
Advantages of Using Managed Classes 15
Cross-Language Support 15
Cleaner Architecture 15
XML Support 15
Optimized Object Model 16
Table of Contents
ii
Architectural Overview of ADO.NET 16
.NET Data Providers 16
Data Provider Components 16
Existing Data Providers 19
The DataSet 21
The DataTable Class 23
Updating the Data Source 24
ADO.NET and XML 25
Typed DataSets 27
ADO.NET and ADO 2.6 28
Disconnected Data Access 29
Read-Only, Forward-Only Access 30
Provider-Specific Classes 31
Using ADO 2.x in .NET 34
Using ADO.NET 36
C# Example 36
Visual Basic.NET Example 36
JScript.NET Example 37
Managed C++ Example 38
J# Example 39
ADO.NET Events 40
Summary 42
Chapter 2: The .NET Data Providers 45
The SQL Server Data Provider 46
The OLE DB Data Provider 47
Meet the Players 47
Connection 48
Command 49
DataReader 49
DataAdapter 52
Establishing Connections 53
The SqlConnection and OleDbConnection Classes 53
Constructing a Connection 53
Storing Connection Strings in the Configuration File 54
Connection Events 56
Connection Pooling in the Data Providers 58
Using Commands 59
The SqlCommand and OleDbCommand Classes 59
Using a Command with a T-SQL Statement 59
Executing the Command 60
Using a Command with a Stored Procedure 63
Using the SqlParameter and OleDbParameter Classes 64
Summary 67
Table of Contents
iii
Chapter 3: Visual Studio .NET and ADO.NET 69
Connection Classes 70
SqlConnection and OleDbConnection Data Components 70
Adding the Connection String 72
Retrieving Connection Strings Programmatically 76
Adding an Event 77
Command Data Components 79
SqlCommand and OledbCommand Data Components 80
Defining a Query Command 81
Executing a Stored Procedure 87
Data Adapter Components 91
Table Mappings 101
DataSet Data Component 103
The Typed Dataset 104
Adding a Typed Dataset to the Project 104
Relating Two or More Tables 108
Generating and Filling a Typed DataSet Object 110
Using the Techniques Acquired to Create a Web Service 112
The DataView Data Component 116
Using the DataView to View Selected Rows 117
Filtering Rows Using a Filter Expression 117
Filtering Rows on Row State 118
Using the DataView to Sort Rows 119
The DataGrid Component 120
DataGrid Web Component 120
Binding the DataGrid Component to a Data Source 120
Formatting the DataGrid 122
Sorting DataGrid Records 125
Selecting, Editing, Updating, and Deleting DataGrid Records 125
Breaking a DataGrid into Pages 128
DataGrid Window Component 129
Summary 130
Chapter 4: Using DataReaders 133
A Note About the Chapter Contents 134
The Basics of a DataReader 135
The IDataReader Interface 135
The IDataRecord Interface 135
The ADO.NET DataReaders 136
DataReader Operations 138
Creating a DataReader 139
The ExecuteReader Method 139
Creating and Using a DataReader 140
Table of Contents
iv
Simple Data Retrieval With the DataReader 141
Executing Stored Procedures with a DataReader 143
Navigating Multiple Result Sets 147
Accessing the Data in a Type-Safe Manner 148
SQL Server Types 150
Getting the Result Set's Schema 151
Bringing it all Together 153
Commonly Encountered Exceptions 157
IndexOutOfBoundsException 157
InvalidOperationException 158
DataReader Performance Considerations 158
Column Ordinal versus Column Name 159
Type Safe Access versus Non-Type-Safe Access 160
Summary 161
Chapter 5: The DataSet 163
The DataTable 164
DataColumn 165
DataRow 166
Constraints 166
Primary Key 167
Dynamically Constructing a DataTable 168
DataTable Events 169
DataTable Events Example 170
Populating a DataSet 180
Constructing a DataAdapter 181
Invoking Fill 182
DataAdapter Example 183
The Tables Collection 185
Populating the Tables Collection with Multiple DataTables 185
Multiple DataSet Tables Example 186
Retrieving the Tables Collection Metadata 188
The Relations Collection 190
DataRelations Example 192
Merging DataSets 197
Merging Two DataSets 198
Merging Two DataSets and Maintaining Original Values 198
Merging Two DataSets with Different Schemas 198
Caching DataSets for Better Performance 199
Summary 204
Table of Contents
v
Chapter 6: Using the DataAdapter 207
The DataAdapter Base Class 207
DataAdapter and DataSet 208
More Details for the Fill Method 212
Using More Complex Queries 213
Filling a DataSet Object with Few Records 217
Filling a DataSet Object with Only the Schema 219
Filling a DataSet Object that Already has a Schema 222
Updating a Database 222
Using a CommandBuilder Object 223
Using SQL Commands 225
Making Updates Using Stored Procedures 228
The DataAdapter's Events 230
Summary 232
Chapter 7: Typed DataSets and DataSet Schemas 235
Overview of XSD 236
Simple Types 236
Basic Data Types 236
Attributes 238
Enumerations 239
User-Defined Types 240
Facets 240
Complex Types 241
Mixed Attribute 241
Element Groups 242
ll Element 242
choice Element 242
sequence Element 243
group Element 243
Attribute Groups 244
XSD Annotation 244
documentation Element 245
appinfo Element 245
XmlSchema Class 245
DataSet Schemas 247
Schema Translation 247
Generating Tables and Columns 248
Constraints 250
Keys 250
Unique Constraints 250
Foreign Keys (Keyrefs) and Relationships 250
Typed DataSets 254
Building Strongly Typed DataSets in Visual Studio .NET 255
Building Typed DataSets Manually 259
Strongly Typed DataSets and Relational Data 260
Typed DataSet Performance 262
Table of Contents
vi
Annotating Typed DataSets 262
codegen 263
typedName 263
typedPlural 263
typedParent 263
typedChildren 263
nullValue 263
msdata 264
ConstraintName 264
ConstraintOnly 264
UpdateRule 264
DeleteRule 264
PrimaryKey 264
Relationship 264
Annotated Typed DataSet Example 265
Summary 268
Chapter 8: XML and the DataSet 271
XmlDocument (W3C DOM) 272
XPath 275
Axis 276
Node Test 277
Predicate 277
DataSet Schemas 280
Schema Inference 280
Inference Rules 280
Inference Rules in Action 281
Supplied Schemas 285
Document Validation with Schemas 286
XmlValidatingReader 286
DataSets and XML Data 289
Loading XML 289
XmlReadMode 290
Writing XML 291
Fidelity Loss and DataSet Schemas 293
DataSet Marshaling 295
DataSet Serialization 295
Transferring DataSet XML Between Applications 295
Data Filtering 299
Select Method 300
Data Views 303
The DataSet and the XmlDataDocument 305
Relational Projection of DOM View via XSD 306
Relational Projection Views with a Typed DataSet 309
Using XSL and XSLT Transformations 310
Summary 314
Table of Contents
vii
Chapter 9: Constraints, Relations, and Views 317
Constraints 318
Unique Constraint 319
ForeignKeyConstraint 321
Custom Constraint 326
DataRelations 333
XML and DataRelations 337
DataViews 340
Sorting 341
Filtering 343
Operators 344
Relationship Referencing 344
Aggregate Functions 345
Functions 346
Filtering on Row State 346
Editing Data in the DataView 348
DataViewManager 349
Databinding 350
Bringing it Together 352
Examples 354
Example 1 354
Example 2 357
Summary 362
Chapter 10: Transactions 365
What is a Transaction? 365
ACID Properties 366
Database Transactions 366
Transaction Vocabulary 367
ADO.NET Transaction Support 367
Transaction Class 369
Methods of the Transaction class 369
Writing Transactional Database Applications 370
Implementing Transactions 370
Running the Application 373
Examining the Effect of Isolation Level 373
What are Isolation Levels? 374
Some Related Terms 374
Possible Isolation Levels in ADO.NET 374
Changing Isolation Levels 375
When to Use Transactions 377
Transactions and Performance 378
Default Behavior for Transactions 378
Transactions and User Confirmation 378
Simultaneous ADO.NET and DBMS Transactions 379
Table of Contents
viii
Advanced Techniques 379
Savepoints 379
Nested Transactions 382
Using Transactions with a DataSet and DataAdapter 382
Summary 384
Chapter 11: Mapping 387
Using the SQL AS Keyword 387
The ADO.NET Mapping Mechanism 389
Using Mapping when Retrieving Data 389
The MissingMappingAction and MissingSchemaAction Properties 392
Inserting Records Using Mapped Names 393
Web Services with Mapping 396
Creating the Supplier Database 398
Creating the Supplier Web Service 400
Creating the Pet Lovers Application 401
Summary 406
Chapter 12: Making a Data Services Component 409
Installing ODBC .NET 410
What is a Data Service Component and Why Use it? 411
What is the Data Servic e Component? 411
What are the Benefits? 412
Creating a Data Service Component 413
The Data Service Component 413
The DataLayer Namespace – Public Enumerators 414
The ConfigSettings Class – Public Properties 415
The ConfigSettings Class – Public Constructors 416
The Commands Class – Public ExecuteQuery Method 418
The Commands Class – Public ExecuteNonQuery Method 422
The Commands Class – Private Connection Method 422
Creating an Assembly Information File 423
Compiling the Data Service Component 424
Deploying a Data Service Component 425
The Global Assembly Cache – (GAC) 425
Making a Reference to Wrox_DL in machine.config 428
Using the Data Service Component 428
Using in a ASP.NET Web Form 429
Executing SQL Text 429
Executing Stored Procedures 435
Using in a Web Service 438
Table of Contents
ix
Performance and Optimization Tips 440
Object Pooling 440
Building a Hit Tracker Component 441
Transactions 448
Uninstalling the Components 452
Summary 453
Chapter 13: ADO.NET and Web Services 455
Setting Up the Code Samples 456
Web Services – The New DCOM 458
Common Standards 458
Supply and Demand – Web Service Providers and Consumers 459
Building a Basic Web Service 460
Building a Basic Consumer 465
Building an HTTP Consumer 466
Capturing the Data in an XmlDocument 469
Build a SOAP Consumer in Visual Studio .NET 471
Discovering Web Services 472
Building the Consumer Code Behind Class 477
What is a Proxy Client? 480
The WSDL.exe Utility 482
Storing a Web Service URL in a Configuration File 484
Exchanging Data in Web Services 485
Working with DataSets 486
Building a Pre-populated DataSet Derived Class 486
Building the Web Service Method 488
Building a Windows Form Consumer with Visual Studio .NET 489
Running the Windows Form Project 491
DataSets as Input Arguments 491
Building a Web Form Consumer 493
Using XML with Web Services 498
Working with Custom Classes as XML 499
Working with XML Attributes 503
Working with XML Elements and Attributes 504
Working with Multiple Custom Classes As XML 505
Web Service Security 506
Using Windows Authentication 507
Adding Credentials to a Consumer 507
Using SOAP-based Authentication 508
Building a Private Web Service 509
Building the Consumer 511
Summary 514
Table of Contents
x
Chapter 14: SQL Server Native XML Support 517
FOR XML 518
FOR XML – Optional Arguments 521
FOR XML RAW 522
Using FOR XML RAW with ADO.NET 523
FOR XML AUTO 525
FOR XML AUTO and ADO.NET 527
FOR XML EXPLICIT 529
FOR XML EXPLICIT – Two-Level Example 531
Entity Encoding 532
Directives 533
FOR XML EXPLICIT – Three-Level Example 536
FOR XML EXPLICIT – ADO.NET 539
FOR XML EXPLICIT – Conclusion 541
OPENXML 541
OPENXML Stored Procedures: Deletion and Updates 544
OPENXML ADO.NET: Insertion, Deletion, and Updates 545
Summary 547
Chapter 15: Performance and Security 551
Optimizing Data Access 551
DataReader or DataSet? 552
Memory Consumption 552
Traversal Direction 552
Multiple Result Sets 553
Round Trips 553
Stored Procedures 554
Compiled Query Caching 555
Configuring DataAdapter Commands 555
High-Volume Data Processing 559
Latency 559
Cached Data 560
ASP.NET Object Caching 564
Birds of a Feather (Functionality Grouping) 567
Marshaling Considerations 568
DataSet Serialization 569
XML over HTTP 571
Connection Pooling 571
SqlConnection 572
OleDbConnection 572
Message Queuing 573
To Queue or Not to Queue 573
Sending Messages 574
Receiving Messages 575
Table of Contents
xi
Security Concerns 576
Code Access Security 576
Administration 577
Code Groups 577
Permission Sets 578
Permissions 578
CAS in Action 579
SSL 583
Encryption 584
Summary 586
Chapter 16: Integration and Migration 589
InterOp 590
COM InterOp and the RCW 590
Accessing ADO from .NET 590
Whether to Access ADO from .NET 590
Accessing ADO from .NET 591
Platform Invocation Services (PInvoke) 594
Migration 595
ADO Data Types 596
Migrating Connections 597
Migrating the Recordset 599
Forward-Only Data Access 600
Publishing RecordSet Changes 603
Migrating Commands and Stored Procedures 609
Changes in XML Persistence 615
Handling Exceptions and Errors 618
Streams 620
Summary 622
Chapter 17: Creating a Custom .NET Data Provider 625
Data Provider Library 626
Application Requirements 626
Retail Store 626
E-Commerce Site 627
Telephone Sales 627
Architecture and Design 627
Distributed Order Entry System 628
The Order Class and Schema 629
A Sample Order 629
Implementing the Data Provider Assembly 630
The OQProvider Namespace 630
The OrderObject 631
The OrderItem 634
Table of Contents
xii
An MSMQ Review 636
Sending Messages 636
Receiving Messages 638
The OQConnection 638
The OQCommand 643
The OQParameterCollection and OQParameter 648
The OQDataReader 652
The OQDataAdapter 657
The OQException 663
Utilizing the Custom Data Provider 663
A Retail Store Interface 664
An E-Commerce Web Site Interface 665
The Telephone Sales Interface 667
Summary 669
Chapter 18: Case Study – Cycle Couriers 671
Requirements 673
Customer 674
Recipient (Addressee) 674
Cyclist 674
Call Center Operator 675
Design 675
User Interface Layer 676
The Customers View 677
The Cyclist View 679
The Call Center Operator View 679
Business Layer 681
Customer 681
Package 681
Cyclist 681
User Authentication 682
Package Status Change 682
Data layer 682
Implementation 683
Database Detail 683
Customers 683
Cyclists Table 684
CyclistStates Table 684
Packages Table 684
Relationships 686
Class Description 686
ServiceCustomer 687
ServicePackage 689
ServiceCyclist 692
Web Interface classes 693
Call Center Operator Application 696
Hardware Configuration 699
Table of Contents
xiii
How to Deploy the System 700
Installing the Web Application and Web Service 700
Installing the Client – Call Center Application. 702
How to Build the System 703
Summary 704
Index 707
 
آخرین ویرایش:

saalek110

Well-Known Member
نقل از :
http://forum.persiantools.com/t82834.html

Babak گفت:
منظور این کتاب هست ؟

Visual Basic.NET How to Program, Second Edition
ISBN: 0130293636
Author: Harvey M. Deitel
Publisher: Prentice Hall

The authoritative DEITEL LIVE-CODE introduction to Windows ; , .NET, Internet and World Wide Web programming in Visual Basic ; .NET This exciting new Second Edition of the Deitels' best-selling Visual Basic textbook carefully explains how to use Visual Basic .NET a premier language in Microsoft's new .NET initiative as a general-purpose programming language and how to program multi-tier, client/server, database-intensive, Internet- and Web-based .NET applications.


Dr. Harvey M. Deitel and Paul J. Deitel are the founders of Deitel and Associates, Inc., the internationally-recognized corporate-training and content-creation organization specializing in Visual Basic ; .NET, C#, Visual C++ ; .NET, Java , C++, C, XML , Python, Perl; Internet, Web, wireless, e-business and object technologies. The Deitels are the authors of several worldwide #1 programming-language textbooks, including Java How to Program, 4/e, C++ How to Program, 3/e and Internet and World Wide Web How to Program, 2/e.

In Visual Basic .NET How to Program, 2/e, the Deitels and their colleague, Tem. R. Nieto, discuss topics you need to build complete .NET, Web-based applications, including: .NET Introduction/IDE/Debugger Control Structures/Procedures/Arrays Classes/Data Abstraction/Strings OOP/Inheritance/Polymorphism Methods/Properties/Events/Delegates Data Structures/Collections/Unicode ; Database/ADO.NET/SQL Assemblies/Modules/Exceptions GUI/Forms/Controls/Visual Inheritance Web Services/ASP.NET/Web Forms XML/XSLT /DOM /DTD/Schema VoiceXML /Regular Expressions Files/Streams/Multimedia/Graphics/GDI+ Multithreading/Client-Server/Networking Session Tracking/Cookies/Accessibility HTML 4/XHTML /COM Integration Visual Basic .NET How to Program, 2/e includes extensive pedagogic features:

Hundreds of LIVE-CODE programs with screen captures that show exact outputs Extensive World Wide Web and Internet resources to encourage further research Hundreds of tips, recommended practices and cautions all marked with icons Visual Basic .NET How to Program, 2/e is the centerpiece of a complete family of resources for teaching and learning Visual Basic .NET, including several Web sites ( www.deitel.com and [A HREF="http://www.prenhall.com/deitel"> www.prenhall.com/deitel ) with the book's source-code examples (which are also on the enclosed CD) and other information for faculty, students and professionals;


360 mb PDF compressed into 5 parts (58 mb total):​
کد:
http://rapidshare.de/files/18208637/VisualBasic.NETHowtoProgram2ed.part01.rar 
http://rapidshare.de/files/18209410/VisualBasic.NETHowtoProgram2ed.part02.rar 
http://rapidshare.de/files/18210562/VisualBasic.NETHowtoProgram2ed.part03.rar 
http://rapidshare.de/files/18211484/VisualBasic.NETHowtoProgram2ed.part04.rar 
http://rapidshare.de/files/18212002/VisualBasic.NETHowtoProgram2ed.part05.rar
a1.jpg
سالک : من دانلود کردم . یک pdf با حجم 350 مگا ساخته شد.
کتاب مصور است و با رنگهای متنوع . کلا کتاب مجللی است. به قول معروف (( ببین از دستت نره.))
فهرست کتاب:

کد:
Illustrations
1 Introduction to Computers, Internet and Visual Basic .NET
1.1 .NET Languages. 19
2 Introduction to the Visual Studio .NET IDE
2.1 Start Page in Visual Studio .NET. 35
2.2 New Project dialog. 36
2.3 Design view of Visual Studio .NET IDE. 37
2.4 Visual Studio .NET IDE menu bar. 38
2.5 Summary of Visual Studio .NET IDE menus. 38
2.6 IDE Toolbar. 38
2.7 Tool tip demonstration. 39
2.8 Toolbar icons for three Visual Studio .NET IDE windows. 39
2.9 Auto-hide feature demonstration. 40
2.10 Solution Explorer with an open solution. 41
2.11 Toolbox window. 42
2.12 Properties window. 43
2.13 Help menu commands. 44
2.14 Dynamic Help window. 44
2.15 Simple program executing. 45
2.16 Creating a new Windows Application. 46
2.17 Setting the project location in the Project Location dialog. 47
2.18 Setting the form’s Text property. 47
2.19 Form with sizing handles. 48
2.20 Changing the form’s BackColor property. 48
2.21 Adding a label to the form. 49
2.22 GUI after the form and label have been customized. 50
2.23 Properties window displaying the label’s properties. 50
2.24 Font dialog for selecting fonts, styles and sizes. 51
Illustrations XIX
2.25 Centering the label’s text. 51
2.26 Inserting and aligning the picture box. 52
2.27 Image property of the picture box. 52
2.28 Selecting an image for the picture box. 53
2.29 Picture box displaying an image. 53
2.30 IDE in run mode, with the running application in the foreground. 54
3 Introduction to Visual Basic Programming
3.1 Simple Visual Basic program. 63
3.2 Creating a Console Application with the New Project dialog. 65
3.3 IDE with an open console application. 66
3.4 Renaming the program file in the Properties window. 66
3.5 IntelliSense feature of the Visual Studio .NET IDE. 68
3.6 Parameter Info and Parameter List windows. 68
3.7 Executing the program shown in Fig. 3.1. 68
3.8 IDE indicating a syntax error. 69
3.9 Using multiple statements to print a line of text. 69
3.10 Addition program that adds two numbers entered by the user. 70
3.11 Dialog displaying a run-time error. 72
3.12 Memory location showing name and value of variable number1. 74
3.13 Memory locations after values for variables number1 and number2
have been input. 74
3.14 Memory locations after an addition operation. 74
3.15 Arithmetic operators. 75
3.16 Precedence of arithmetic operators. 76
3.17 Order in which a second-degree polynomial is evaluated. 79
3.18 Equality and relational operators. 79
3.19 Performing comparisons with equality and relational operators. 80
3.20 Precedence and associativity of operators introduced in this chapter. 82
3.21 Displaying text in a dialog. 83
3.22 Dialog displayed by calling MessageBox.Show. 85
3.23 Obtaining documentation for a class by using the Index dialog. 85
3.24 Documentation for the MessageBox class. 85
3.25 Adding a reference to an assembly in the Visual Studio .NET IDE. 86
3.26 Internet Explorer window with GUI components. 87
4 Control Structures: Part 1
4.1 Sequence structure flowchart. 100
4.2 Keywords in Visual Basic. 101
4.3 If/Then single-selection structure flowchart. 103
4.4 If/Then/Else double-selection structure flowchart. 105
4.5 While repetition structure used to print powers of two. 107
4.6 While repetition structure flowchart. 107
4.7 Do While/Loop repetition structure demonstration. 108
4.8 Do While/Loop repetition structure flowchart. 109
4.9 Do Until/Loop repetition structure demonstration. 109
XX Illustrations
4.10 Do Until/Loop repetition structure flowchart. 110
4.11 Assignment operators. 111
4.12 Exponentiation using an assignment operator. 111
4.13 Pseudocode algorithm that uses counter-controlled repetition to
solve the class-average problem. 112
4.14 Class-average program with counter-controlled repetition. 112
4.15 Pseudocode algorithm that uses sentinel-controlled repetition to
solve the class-average problem. 116
4.16 Class-average program with sentinel-controlled repetition. 117
4.17 Pseudocode for examination-results problem. 122
4.18 Nested control structures used to calculate examination results. 122
4.19 Second refinement of the pseudocode. 126
4.20 Nested repetition structures used to print a square of *s. 126
4.21 IDE showing program code for Fig. 2.15. 129
4.22 Windows Form Designer generated code when expanded. 130
4.23 Code generated by the IDE for lblWelcome. 130
4.24 Properties window used to set a property value. 131
4.25 Windows Form Designer generated code reflecting new property values. 132
4.26 Changing a property in the code view editor. 132
4.27 New Text property value reflected in design mode. 132
4.28 Adding program code to FrmASimpleProgram_Load. 133
4.29 Method FrmASimpleProgram_Load containing program code. 134
4.30 Changing a property value at runtime. 134
5 Control Structures: Part 2
5.1 Counter-controlled repetition with the While structure. 146
5.2 Counter-controlled repetition with the For/Next structure. 146
5.3 For/Next header components. 148
5.4 For/Next repetition structure flowchart. 149
5.5 For/Next structure used for summation. 150
5.6 Message dialog icon constants. 151
5.7 Message dialog button constants. 151
5.8 For/Next structure used to calculate compound interest. 152
5.9 Formatting codes for Strings. 154
5.10 Select Case structure used to count grades. 155
5.11 Select Case multiple-selection structure flowchart. 158
5.12 Do/Loop While repetition structure. 159
5.13 Do/Loop While repetition structure flowchart. 160
5.14 Do/Loop Until repetition structure. 160
5.15 Do/Loop Until repetition structure flowchart. 161
5.16 Exit keyword in repetition structures. 162
5.17 Truth table for the AndAlso operator. 165
5.18 Truth table for the OrElse operator. 166
5.19 Truth table for the logical exclusive OR (Xor) operator. 167
5.20 Truth table for operator Not (logical NOT). 167
5.21 Logical operator truth tables. 168
Illustrations XXI
5.22 Precedence and associativity of the operators discussed so far. 169
5.23 Visual Basic’s single-entry/single-exit sequence and selection structures. 170
5.24 Visual Basic’s single-entry/single-exit repetition structures. 171
5.25 Structured programming rules. 172
5.26 Simplest flowchart. 173
5.27 Repeatedly applying rule 2 of Fig. 5.25 to the simplest flowchart. 173
5.28 Applying rule 3 of Fig. 5.25 to the simplest flowchart. 174
5.29 Stacked, nested and overlapped building blocks. 175
5.30 Unstructured flowchart. 175
6 Procedures
6.1 Hierarchical boss-procedure/worker-procedure relationship. 185
6.2 Sub procedure for printing payment information. 185
6.3 Function procedure for squaring an integer. 188
6.4 Method that determines the largest of three numbers. 190
6.5 Parameter Info feature of the Visual Studio .NET IDE. 193
6.6 IntelliSense feature of the Visual Studio .NET IDE. 193
6.7 Math class methods. 194
6.8 Widening conversions. 196
6.9 Property Pages dialog with Option Strict set to On. 197
6.10 Visual Basic primitive data types. 198
6.11 Literals with type characters. 199
6.12 ByVal and ByRef used to pass value-type arguments. 201
6.13 Scoping rules in a class. 204
6.14 Random integers created by calling method Next of class Random. 208
6.15 Demonstrates 4 die rolls. 209
6.16 Random class used to simulate rolling 12 six-sided dice. 211
6.17 Craps game using class Random. 214
6.18 Recursive evaluation of 5!. 219
6.19 Recursive factorial program. 220
6.20 Recursively generating Fibonacci numbers. 222
6.21 Recursive calls to method Fibonacci. 224
6.22 Overloaded methods. 226
6.23 Syntax error generated from overloaded procedures with identical
parameter lists and different return types. 228
6.24 Optional argument demonstration with method Power. 229
6.25 Module used to define a group of related procedures. 231
6.26 Testing the modDice procedures. 232
6.27 Printing the results of cubing 10 numbers. 238
6.28 Towers of Hanoi for the case with four disks. 244
7 Arrays
7.1 Array consisting of 12 elements. 247
7.2 Creating an array. 250
7.3 Initializing array elements two different ways. 251
7.4 Computing the sum of the elements in an array. 252
7.5 Simple student-poll analysis program. 254
XXII Illustrations
7.6 Program that prints histograms. 256
7.7 Using arrays to eliminate a Select Case structure. 257
7.8 Passing arrays and individual array elements to procedures. 261
7.9 Passing an array reference with ByVal and ByRef. 265
7.10 BubbleSort procedure in modBubbleSort. 268
7.11 Sorting an array with bubble sort. 269
7.12 Procedures for performing a linear search. 272
7.13 Linear search of an array. 273
7.14 Binary search of a sorted array. 276
7.15 Two-dimensional array with three rows and four columns. 280
7.16 Initializing multidimensional arrays. 281
7.17 Using jagged two-dimensional arrays. 283
7.18 Creating variable-length parameter lists. 287
7.19 Using For Each/Next with an array. 288
8 Object-Based Programming
8.1 Abstract data type representing time in 24-hour format. 299
8.2 Using an abstract data type. 303
8.3 Attempting to access restricted class members results in a syntax error. 307
8.4 Overloading constructors. 309
8.5 Overloaded-constructor demonstration. 312
8.6 Properties in a class. 314
8.7 Graphical user interface for class CTime3. 318
8.8 CDay class encapsulates day, month and year information. 321
8.9 CEmployee class encapsulates employee name, birthday and hire date. 323
8.10 Composition demonstration. 324
8.11 Class using Me reference. 325
8.12 Me reference demonstration. 326
8.13 CEmployee2 class objects share Shared variable. 328
8.14 Shared class member demonstration. 330
8.15 Constants used in class CCircleConstants. 332
8.16 Const and ReadOnly class member demonstration. 333
8.17 CEmployee3 class to store in class library. 336
8.18 Simple class library project. 338
8.19 Module modAssemblyTest references EmployeeLibrary.dll. 339
8.20 Class View of Fig. 8.1 and Fig. 8.2. 341
8.21 Invoking the Object Browser from the development environment. 342
8.22 Object Browser when user selects Object from development
environment. 343
9 Object-Oriented Programming: Inheritance
9.1 Inheritance examples. 352
9.2 Inheritance hierarchy for university CCommunityMembers. 353
9.3 Portion of a CShape class hierarchy. 354
9.4 CPoint class represents an x-y coordinate pair. 355
9.5 modPointTest demonstrates class CPoint functionality. 357
Illustrations XXIII
9.6 CCircle class contains an x-y coordinate and a radius. 358
9.7 modCircleTest demonstrates class CCircle functionality. 360
9.8 CCircle2 class that inherits from class CPoint. 362
9.9 CPoint2 class represents an x-y coordinate pair as Protected data. 364
9.10 CCircle3 class that inherits from class CPoint2. 365
9.11 modCircleTest3 demonstrates class CCircle3 functionality. 367
9.12 CCircle4 class that inherits from class CPoint, which does not
provide Protected data. 369
9.13 modCircleTest4 demonstrates class CCircle4 functionality. 371
9.14 CCylinder class inherits from class CCircle4 and Overrides
method Area. 373
9.15 Testing class CCylinder. 375
9.16 CPoint3 base class contains constructors and finalizer. 378
9.17 CCircle5 class inherits from class CPoint3 and overrides a
finalizer method. 379
9.18 Demonstrating order in which constructors and finalizers are called. 381
10 Object-Oriented Programming: Polymorphism
10.1 CPoint class represents an x-y coordinate pair. 390
10.2 CCircle class that inherits from class CPoint. 391
10.3 Assigning derived-class references to base-class references. 393
10.4 Abstract CShape base class. 400
10.5 CPoint2 class inherits from MustInherit class CShape. 401
10.6 CCircle2 class that inherits from class CPoint2. 403
10.7 CCylinder2 class inherits from class CCircle2. 404
10.8 CTest2 demonstrates polymorphism in Point-Circle-Cylinder hierarchy. 406
10.9 MustInherit class CEmployee definition. 410
10.10 CBoss class inherits from class CEmployee. 411
10.11 CCommissionWorker class inherits from class CEmployee. 412
10.12 CPieceWorker class inherits from class CEmployee. 414
10.13 CHourlyWorker class inherits from class CEmployee. 416
10.14 CTest class tests the CEmployee class hierarchy. 417
10.15 Interface for returning age of objects of disparate classes. 420
10.16 CPerson class implements IAge interface. 421
10.17 CTree class implements IAge interface. 422
10.18 Demonstrate polymorphism on objects of disparate classes. 423
10.19 IShape interface provides methods Area and Volume and
property Name. 426
10.20 CPoint3 class implements interface IShape. 426
10.21 CCircle3 class inherits from class CPoint3. 427
10.22 CCylinder3 class inherits from class CCircle3. 429
10.23 CTest3 uses interfaces to demonstrate polymorphism in
Point-Circle-Cylinder hierarchy. 431
10.24 Bubble sort using delegates. 433
10.25 Bubble-sort Form application. 435
XXIV Illustrations
11 Exception Handling
11.1 Exception handlers for FormatException and
DivideByZeroException. 447
11.2 Finally statements always execute, regardless of whether an
exception occurs. 454
11.3 Exception properties and stack unwinding. 462
11.4 ApplicationException derived class thrown when a program
performs an illegal operation on a negative number. 465
11.5 FrmSquareRoot class throws an exception if an error occurs
when calculating the square root. 466
11.6 OverflowException cannot occur if user disables
integer-overflow checking. 468
12 Graphical User Interface Concepts: Part 1
12.1 GUI components in a sample Internet Explorer window. 477
12.2 Some basic GUI components. 477
12.3 Components and controls for Windows Forms. 478
12.4 Common Form properties, methods and events. 479
12.5 Event-handling model using delegates. 480
12.6 Events section in the Method Name drop-down menu. 482
12.7 Simple event-handling example using visual programming. 482
12.8 List of Form events. 486
12.9 Click event details. 486
12.10 Class Control properties and methods. 487
12.11 Anchoring demonstration. 489
12.12 Manipulating the Anchor property of a control. 489
12.13 Docking demonstration. 490
12.14 Control layout properties. 490
12.15 Common Label properties. 491
12.16 TextBox properties and events. 492
12.17 Button properties and events. 493
12.18 Program to display hidden text in a password box. 493
12.19 GroupBox properties. 495
12.20 Panel properties. 495
12.21 Creating a Panel with scrollbars. 495
12.22 Using GroupBoxes and Panels to arrange Buttons . 496
12.23 CheckBox properties and events. 498
12.24 Using CheckBoxes to change font styles . 498
12.25 RadioButton properties and events. 501
12.26 Using RadioButtons to set message-window options. 502
12.27 PictureBox properties and events. 508
12.28 Using a PictureBox to display images . 508
12.29 Mouse events, delegates and event arguments. 510
12.30 Using the mouse to draw on a form. 511
12.31 Keyboard events, delegates and event arguments. 513
Illustrations XXV
12.32 Demonstrating keyboard events. 514
12.33 Abbreviations for controls introduced in chapter. 517
13 Graphical User Interfaces Concepts: Part 2
13.1 Expanded and checked menus. 525
13.2 Visual Studio .NET Menu Designer 526
13.3 Adding MenuItems to MainMenu. 527
13.4 MainMenu and MenuItem properties and events. 527
13.5 Menus for changing text font and color. 528
13.6 LinkLabel control in running program. 534
13.7 LinkLabel properties and events. 534
13.8 LinkLabels used to link to a drive, a Web page and an application. 536
13.9 ListBox and CheckedListBox on a form. 538
13.10 ListBox properties, methods and events. 538
13.11 String Collection Editor. 540
13.12 Program that adds, removes and clears ListBox items. 540
13.13 CheckedListBox properties, methods and events. 543
13.14 CheckedListBox and ListBox used in a program to display a
user selection. 544
13.15 ComboBox demonstration. 546
13.16 ComboBox properties and events. 546
13.17 ComboBox used to draw a selected shape. 547
13.18 TreeView displaying a sample tree. 550
13.19 TreeView properties and events. 550
13.20 TreeNode properties and methods. 551
13.21 TreeNode Editor. 552
13.22 TreeView used to display directories. 553
13.23 ListView properties and events. 556
13.24 Image Collection Editor window for an ImageList component. 556
13.25 ListView displaying files and folders. 557
13.26 Tabbed windows in Visual Studio .NET. 562
13.27 TabControl with TabPages example. 563
13.28 TabPages added to a TabControl. 563
13.29 TabControl properties and events. 564
13.30 TabControl used to display various font settings. 564
13.31 MDI parent window and MDI child windows. 568
13.32 SDI and MDI forms. 568
13.33 MDI parent and MDI child events and properties. 569
13.34 Minimized and maximized child windows. 570
13.35 MenuItem property MdiList example. 571
13.36 LayoutMdi enumeration values. 572
13.37 MDI parent-window class. 572
13.38 MDI child FrmChild. 575
13.39 Class FrmInheritance, which inherits from class Form, contains
a button (Learn More). 577
13.40 Visual Inheritance through the Form Designer. 578
XXVI Illustrations
13.41 Class FrmVisualTest, which inherits from class
VisualForm.FrmInheritance, contains an additional button. 579
13.42 Custom control creation. 581
13.43 UserControl-defined clock. 581
13.44 Custom-control creation. 583
13.45 Project properties dialog. 583
13.46 Custom control added to the ToolBox. 584
13.47 Custom control added to a Form. 584
13.48 Prefixes for controls used in chapter. 585
14 Multithreading
14.1 Thread life cycle. 595
14.2 Thread-priority scheduling. 597
14.3 ThreadStart delegate Print displays message and sleeps for
arbitrary duration of time. 598
14.4 Threads sleeping and printing. 600
14.5 Unsynchronized shared Integer buffer. 604
14.6 Producer places Integers in unsynchronized shared buffer. 605
14.7 Consumer reads Integers from unsynchronized shared buffer. 606
14.8 Producer and consumer threads accessing a shared object without
synchronization. 608
14.9 Synchronized shared Integer buffer. 610
14.10 Producer places Integers in synchronized shared buffer. 612
14.11 Consumer reads Integers from synchronized shared buffer. 612
14.12 Producer and consumer threads accessing a shared object with
synchronization. 613
14.13 Synchronized shared circular buffer. 620
14.14 Producer places Integers in synchronized circular buffer. 623
14.15 Consumer reads Integers from synchronized circular buffer. 624
14.16 Producer and consumer threads accessing a circular buffer. 625
15 Strings, Characters and Regular Expressions
15.1 String constructors. 635
15.2 String Length and Chars properties, and CopyTo method. 637
15.3 String test to determine equality. 639
15.4 StartsWith and EndsWith methods. 642
15.5 GetHashCode method demonstration. 643
15.6 Searching for characters and substrings in Strings. 644
15.7 Substrings generated from Strings. 647
15.8 Concat Shared method. 648
15.9 String methods Replace, ToLower, ToUpper,
Trim and ToString. 649
15.10 StringBuilder class constructors . 651
15.11 StringBuilder size manipulation. 653
15.12 Append methods of StringBuilder. 655
15.13 StringBuilder’s AppendFormat method. 656
15.14 StringBuilder text insertion and removal. 658
Illustrations XXVII
15.15 StringBuilder text replacement. 659
15.16 Char’s Shared character-testing methods and case-conversion methods. 661
15.17 CCard class. 663
15.18 Card dealing and shuffling simulation. 664
15.19 Character classes. 668
15.20 Regular expressions checking birthdays. 668
15.21 Quantifiers used regular expressions. 670
15.22 Validating user information using regular expressions. 670
15.23 Regex methods Replace and Split. 675
16 Graphics and Multimedia
16.1 System.Drawing namespace’s Classes and Structures. 685
16.2 GDI+ coordinate system. Units are measured in pixels. 686
16.3 Color structure Shared constants and their RGB values. 688
16.4 Color structure members. 688
16.5 Classes that derive from class Brush. 689
16.6 Color value and alpha demonstration. 689
16.7 ColorDialog used to change background and text color. 692
16.8 Font class read-only properties. 694
16.9 Fonts and FontStyles. 695
16.10 An illustration of font metrics. 697
16.11 FontFamily methods that return font-metrics information. 697
16.12 FontFamily class used to obtain font-metric information. 697
16.13 Graphics methods that draw lines, rectangles and ovals. 699
16.14 Drawing lines, rectangles and elipses. 700
16.15 Ellipse bounded by a rectangle. 702
16.16 Positive and negative arc angles. 702
16.17 Graphics methods for drawing arcs. 703
16.18 Arc method demonstration. 703
16.19 Graphics methods for drawing polygons. 705
16.20 Polygon drawing demonstration. 705
16.21 Shapes drawn on a form. 709
16.22 Paths used to draw stars on a form. 712
16.23 Image resizing. 714
16.24 Animation of a series of images. 717
16.25 Container class for chess pieces . 718
16.26 Chess-game code (part 1 of 9). 720
16.27 Windows Media Player demonstration. 729
16.28 Peedy introducing himself when the window opens. 732
16.29 Peedy’s Pleased animation. 733
16.30 Peedy’s reaction when he is clicked. 734
16.31 Peedy flying animation 734
16.32 Peedy waiting for speech input. 735
16.33 Peedy repeating the user’s request for Seattle style pizza. 736
16.34 Peedy repeating the user’s request for anchovies as an additional topping. 736
16.35 Peedy recounting the order. 737
XXVIII Illustrations
16.36 Peedy calculating the total. 737
16.37 Microsoft Agent demonstration. 738
16.38 GUI for eight queens exercise. 751
17 Files and Streams
17.1 Data hierarchy. 755
17.2 Visual Basic’s view of an n-byte file. 756
17.3 File class methods (partial list). 757
17.4 Directory class methods (partial list). 758
17.5 FrmFileTest class tests classes File and Directory. 759
17.6 FrmFileSearch class uses regular expressions to determine file types. 762
17.7 FrmBankUI class is the base class for GUIs in our
file-processing applications. 767
17.8 CRecord class represents a record for sequential-access file-processing
applications. 770
17.9 FrmCreateSequentialAccessFile class creates and writes
to sequential-access files. 772
17.10 Sample data for the program of Fig. 17.9. 779
17.11 FrmReadSequentialAccessFile class reads sequential-access files. 779
17.12 FrmCreditInquiry class is a program that displays credit inquiries. 783
17.13 Random-access file with fixed-length records. 790
17.14 CRandomAccessRecord class represents a record for
random-access file-processing applications. 791
17.15 FrmCreateRandomAccessFile class create files for
random-access file-processing applications. 794
17.16 FrmWriteRandomAccessFile class writes records to r
andom-access files. 798
17.17 FrmReadRandomAccessFile class reads records from
random-access files sequentially. 802
17.18 CTransaction class handles record transactions for the
transaction-processor case study. 808
17.19 FrmTransactionProcessor class runs the
transaction-processor application. 812
17.20 FrmStartDialog class enables users to access dialog
boxes associated with various transactions. 813
17.21 FrmNewDialog class enables users to create records in
transaction-processor case study. 816
17.22 FrmUpdateDialog class enables users to update records
in transaction-processor case study. 819
17.23 FrmDeleteDialog class enables users to remove records
from files in transaction-processor case study. 825
17.24 Inventory of a hardware store. 832
18 Extensible Markup Language (XML)
18.1 XML used to mark up an article. 834
18.2 article.xml displayed by Internet Explorer. 837
18.3 XML to mark up a business letter. 837
Illustrations XXIX
18.4 XML namespaces demonstration. 839
18.5 Default namespaces demonstration. 841
18.6 Tree structure for Fig. 18.1. 842
18.7 XmlNodeReader iterates through an XML document. 843
18.8 DOM structure of an XML document. 846
18.9 XPathNavigator class navigates selected nodes. 852
18.10 XML document that describes various sports. 859
18.11 XPath expressions and descriptions. 860
18.12 Document Type Definition (DTD) for a business letter. 861
18.13 XML document referencing its associated DTD. 863
18.14 XML Validator validates an XML document against a DTD. 864
18.15 XML Validator displaying an error message. 865
18.16 XML document that conforms to a Microsoft Schema document. 865
18.17 Schema file that contains structure to which book.xml conforms. 866
18.18 Schema-validation example. 867
18.19 XML file that does not conform to the Schema in Fig. 18.17. 869
18.20 XML document containing book information. 871
18.21 XSL document that transforms sorting.xml into XHTML. 872
18.22 XSL style sheet applied to an XML document. 875
18.23 BizTalk terminology. 877
18.24 BizTalk markup using an offer Schema. 878
19 Database, SQL and ADO .NET
19.1 Relational-database structure of an Employee table. 889
19.2 Result set formed by selecting Department and Location data
from the Employee table. 890
19.3 Authors table from Books. 890
19.4 Data from the Authors table of Books. 890
19.5 Publishers table from Books. 891
19.6 Data from the Publishers table of Books. 891
19.7 AuthorISBN table from Books. 892
19.8 Data from AuthorISBN table in Books. 892
19.9 Titles table from Books. 893
19.10 Data from the Titles table of Books. 893
19.11 Table relationships in Books. 896
19.12 SQL query keywords. 897
19.13 authorID and lastName from the Authors table. 898
19.14 Titles with copyrights after 1999 from table Titles. 899
19.15 Authors from the Authors table whose last names start with D. 900
19.16 Authors from table Authors whose last names contain i as their
second letter. 901
19.17 Authors from table Authors in ascending order by lastName. 901
19.18 Authors from table Authors in descending order by lastName. 902
19.19 Authors from table Authors in ascending order by lastName
and by firstName. 903
19.20 Books from table Titles whose titles end with How to Program
in ascending order by title. 904
XXX Illustrations
19.21 Authors from table Authors and ISBN numbers of the authors’
books, sorted in ascending order by lastName and firstName. 905
19.22 Joining tables to produce a result set in which each record contains
an author, title, ISBN number, copyright and publisher name. 906
19.23 Portion of the result set produced by the query in Fig. 19.22. 907
19.24 Table Authors after an INSERT operation to add a record. 909
19.25 Table Authors after an UPDATE operation to change a record. 910
19.26 Table Authors after a DELETE operation to remove a record. 911
19.27 Database access and information display. 913
19.28 SQL statements executed on a database. 921
19.29 Database modification demonstration. 923
19.30 XML representation of a DataSet written to a file. 932
19.31 XML document generated from DataSet in XMLWriter. 934
20 ASP .NET, Web Forms and Web Controls
20.1 Client interacting with Web server. Step 1: The GET request,
GET /books/downloads.htm HTTP/1.1. 944
20.2 Client interacting with Web server. Step 2: The HTTP response,
HTTP/1.1 200 OK. 944
20.3 Three-tier architecture. 945
20.4 ASPX page that displays the Web server’s time. 946
20.5 Code-behind file for a page that displays the Web server’s time. 948
20.6 HTML response when the browser requests WebTime.aspx. 951
20.7 Creating an ASP.NET Web Application in Visual Studio. 953
20.8 Visual Studio creating and linking a virtual directory for the
WebTime project folder. 953
20.9 Solution Explorer window for project WebTime. 953
20.10 Web Forms menu in the Toolbox. 954
20.11 Design mode of Web Form designer. 954
20.12 HTML mode of Web-Form designer. 955
20.13 Code-behind file for WebForm1.aspx generated by Visual Studio .NET. 956
20.14 FlowLayout and GridLayout illustration. 956
20.15 WebForm.aspx after adding two Labels and setting their properties. 957
20.16 Commonly used Web controls. 958
20.17 Web-controls demonstration. 959
20.18 AdRotator class demonstrated on a Web form. 964
20.19 Code-behind file for page demonstrating the AdRotator class. 965
20.20 AdvertisementFile used in AdRotator example. 967
20.21 Validators used in a Web Form that generates possible letter
combinations from a phone number. 970
20.22 Code-behind file for the word-generator page. 972
20.23 HTML and JavaScript sent to the client browser. 976
20.24 ASPX file that presents a list of programming languages x. 981
20.25 Code-behind file that writes cookies to the client. 983
20.26 ASPX page that displays book information. 986
20.27 Cookies being read from a client in an ASP .NET application. 987
Illustrations XXXI
20.28 HttpCookie properties. 989
20.29 Options supplied on an ASPX page. 989
20.30 Sessions are created for each user in an ASP .NET Web application. 991
20.31 HttpSessionState properties. 995
20.32 Session information displayed in a ListBox. 995
20.33 Session data read by an ASP .NET Web application to provide
recommendations for the user. 996
20.34 Guest-book application GUI. 998
20.35 ASPX file for the guest-book application. 999
20.36 Code-behind file for the guest-book application. 1001
20.37 Login Web Form. 1005
20.38 ASCX code for the header. 1007
20.39 Code-behind file for the login page for authors application. 1007
20.40 ASPX file that allows a user to select an author from a drop-down list. 1013
20.41 Database information being inputted into a DataGrid. 1014
20.42 ASPX page with tracing turned off. 1020
20.43 Tracing enabled on a page. 1020
20.44 Tracing information for a project. 1021
21 ASP .NET and Web Services
21.1 ASMX file rendered in Internet Explorer. 1033
21.2 Service description for a Web service. 1034
21.3 Invoking a method of a Web service from a Web browser. 1035
21.4 Results of invoking a Web-service method from a Web browser. 1035
21.5 SOAP request message for the HugeInteger Web service. 1036
21.6 HugeInteger Web service. 1038
21.7 Design view of a Web service. 1044
21.8 Adding a Web service reference to a project. 1045
21.9 Add Web Reference dialog. 1046
21.10 Web services located on localhost. 1046
21.11 Web reference selection and description. 1047
21.12 Solution Explorer after adding a Web reference to a project. 1047
21.13 Using the HugeInteger Web service. 1049
21.14 Blackjack Web service. 1054
21.15 Blackjack game that uses the Blackjack Web service. 1057
21.16 Airline reservation Web service. 1066
21.17 Airline Web Service in design view. 1069
21.18 ASPX file that takes reservation information. 1069
21.19 Code-behind file for the reservation page. 1070
21.20 TemperatureServer Web service. 1073
21.21 Class that stores weather information about a city. 1076
21.22 Receiving temperature and weather data from a Web service. 1077
21.23 Class that stores equation information. 1082
21.24 Web service that generates random equations. 1085
21.25 Returning an object from a Web-service method. 1086
21.26 Math-tutor application. 1087
XXXII Illustrations
22 Networking: Streams-Based Sockets and Datagrams
22.1 Server portion of a client/server stream-socket connection. 1101
22.2 Client portion of a client/server stream-socket connection. 1104
22.3 Server-side portion of connectionless client/server computing. 1110
22.4 Client-side portion of connectionless client/server computing. 1112
22.5 Server side of client/server Tic-Tac-Toe program. 1116
22.6 CPlayer class represents a Tic-Tac-Toe player. 1119
22.7 Client side of client/server Tic-Tac-Toe program. 1122
22.8 CSquare class represents a square on the Tic-Tac-Toe board. 1128
22.9 English letters of the alphabet and decimal digits as expressed
in international Morse code. 1135
23 Data Structures and Collections
23.1 Self-referential CNode class definition. 1138
23.2 Self-referential class objects linked together. 1139
23.3 Linked-list graphical representation. 1141
23.4 Self-referential class CListNode. 1141
23.5 Linked-list CList class. 1142
23.6 Exception thrown when removing node from empty linked list. 1145
23.7 Linked-list demonstration. 1146
23.8 InsertAtFront graphical representation. 1148
23.9 InsertAtBack graphical representation. 1149
23.10 RemoveFromFront graphical representation. 1150
23.11 RemoveFromBack graphical representation. 1151
23.12 Stack implementation by inheritance from class CList. 1153
23.13 Stack-by-inheritance test. 1154
23.14 Stack-by-composition test. 1155
23.15 Queue implemented by inheritance from class CList. 1157
23.16 Queue-by-inheritance test. 1158
23.17 Binary tree graphical representation. 1160
23.18 Binary search tree containing 12 values. 1160
23.19 Tree-node data structure. 1162
23.20 Tree data structure. 1163
23.21 Tree-traversal demonstration. 1166
23.22 A binary search tree. 1167
23.23 Tree node contains IComparables as data. 1169
23.24 Binary tree stores nodes with IComparable data. 1171
23.25 IComparable binary-tree demonstration. 1173
23.26 Array class demonstration. 1176
23.27 ArrayList methods (partial list). 1180
23.28 ArrayList class demonstration. 1180
23.29 Stack class demonstration. 1185
23.30 Hashtable class demonstration. 1190
23.31 CEmployee class. 1194
Illustrations XXXIII
24 Accessibility
24.1 Acts designed to ensure Internet access for people with disabilities. 1205
24.2 We Media’s home page. Wemedia.com home page
(Courtesy of We Media Inc.) 1206
24.3 Enlarging icons using the Customize feature. 1210
24.4 Enlarged icons in the development window. 1210
24.5 Text Editor before modifying the font size. 1211
24.6 Enlarging text in the Options window. 1211
24.7 Text Editor after the font size is modified. 1212
24.8 Adding tabs to the Toolbox. 1213
24.9 Shortcut key creation. 1214
24.10 Removing tabs from the Visual Studio environment. 1214
24.11 Console windows with tabs and without tabs. 1215
24.12 Properties of class Control related to accessibility. 1216
24.13 Application with accessibility features. 1217
24.14 XHTML table without accessibility modifications. 1222
24.15 Table optimized for screen reading using attribute headers. 1223
24.16 Home page written in VoiceXML. 1227
24.17 Publication page of Deitel and Associates’ VoiceXML page. 1229
24.18 VoiceXML tags. 1233
24.19 Hello World CallXML example. (Courtesy of Voxeo,
© Voxeo Corporation 2000–2001). 1234
24.20 CallXML example that reads three ISBN values .
(Courtesy of Voxeo, © Voxeo Corporation 2000–2001.) 1235
24.21 CallXML elements. 1238
24.22 Text Size dialog. 1242
24.23 Display Settings dialog. 1243
24.24 Accessibility Wizard initialization options. 1243
24.25 Scroll Bar and Window Border Size dialog. 1244
24.26 Adjusting up window element sizes. 1244
24.27 Display Color Settings options. 1245
24.28 Accessibility Wizard mouse cursor adjustment tool. 1245
24.29 SoundSentry dialog. 1246
24.30 ShowSounds dialog. 1246
24.31 StickyKeys window. 1247
24.32 BounceKeys dialog. 1247
24.33 ToggleKeys window. 1248
24.34 Extra Keyboard Help dialog. 1248
24.35 MouseKeys window. 1249
24.36 Mouse Button Settings window. 1249
24.37 Mouse Speed dialog. 1250
24.38 Set Automatic Timeouts dialog. 1250
24.39 Saving new accessibility settings. 1251
24.40 Narrator window. 1252
24.41 Voice Settings window. 1252
24.42 Narrator reading Notepad text. 1253
XXXIV Illustrations
24.43 Microsoft On-Screen Keyboard. 1253
24.44 Microsoft Internet Explorer 5.5’s accessibility options. 1254
24.45 Advanced accessibility settings in Microsoft Internet Explorer 5.5. 1255
A Operator Precedence Chart
A.1 Operator precedence chart. 1264
B Number Systems (on CD)
B.1 Digits of the binary, octal, decimal and hexadecimal number systems. 1268
B.2 Comparison of the binary, octal, decimal and hexadecimal
number systems. 1269
B.3 Positional values in the decimal number system. 1269
B.4 Positional values in the binary number system. 1269
B.5 Positional values in the octal number system. 1270
B.6 Positional values in the hexadecimal number system. 1270
B.7 Decimal, binary, octal, and hexadecimal equivalents. 1270
B.8 Converting a binary number to decimal. 1272
B.9 Converting an octal number to decimal. 1272
B.10 Converting a hexadecimal number to decimal. 1273
C Career Opportunities (on CD)
C.1 Monster.com home page. (Courtesy of Monster.com.] 1283
C.2 FlipDog.com job search. (Courtesy of Flipdog.com.) 1284
C.3 List of a job seeker’s criteria. 1286
C.4 Advantage Hiring, Inc.’s Net-Interview™ service. (Courtesy of
Advantage Hiring, Inc.) 1289
C.5 eLance.com request for proposal (RFP) example. (Courtesy
of eLance, Inc.] 1292
D Visual Studio .NET Debugger
D.1 Syntax error. 1303
D.2 Debug sample program. 1304
D.3 Debug configuration setting. 1305
D.4 Setting a breakpoint. 1305
D.5 Console application suspended for debugging. 1305
D.6 Execution suspended at a breakpoint. 1306
D.7 Watch window. 1307
D.8 Autos and Locals windows. 1308
D.9 Immediate window. 1308
D.10 Debug toolbar icons. 1309
D.11 Breakpoints window. 1310
D.12 Disabled breakpoint. 1310
D.13 New Breakpoint dialog. 1311
D.14 Breakpoint Hit Count dialog. 1311
D.15 Breakpoint Condition dialog. 1311
D.16 Demonstrates procedure debugging. 1312
D.17 Call Stack window. 1312
Illustrations XXXV
D.18 IDE displaying a procedures calling point. 1313
D.19 Debug program control features. 1313
D.20 Using the Immediate window to debug procedures. 1314
D.21 Debugging a class. 1314
D.22 Breakpoint location for class debugging. 1315
D.23 Expanded class in Watch window. 1316
D.24 Expanded array in Watch window. 1316
E ASCII Character Set
E.1 ASCII character set. 1319
F Unicode® (on CD)
F.1 Correlation between the three encoding forms. 1323
F.2 Various glyphs of the character A. 1323
F.3 Windows application demonstrating Unicode encoding. 1326
F.4 Some character ranges. 1328
G COM Integration (on CD) 1332
G.1 ActiveX control registration. 1333
G.2 Customize Toolbox dialog with an ActiveX control selected. 1334
G.3 IDE’s toolbox and LabelScrollbar properties. 1335
G.4 ActiveX COM control integration in Visual Basic .NET. 1335
G.5 Add Reference dialog DLL Selection. 1338
G.6 COM DLL component in Visual Basic.NET. 1339
H Introduction to HyperText Markup
Language 4: Part 1 (on CD)
H.1 Basic HTML file. 1347
H.2 Header elements h1 through h6. 1349
H.3 Linking to other Web pages. 1350
H.4 Linking to an email address. 1351
H.5 Placing images in HTML files. 1352
H.6 Using images as link anchors. 1354
H.7 Inserting special characters into HTML. 1356
H.8 Unordered lists in HTML. 1358
H.9 Nested and ordered lists in HTML. 1359
I Introduction to HyperText Markup
Language 4: Part 2 (on CD)
I.1 HTML table. 1368
I.2 Complex HTML table. 1371
I.3 Simple form with hidden fields and a text box. 1373
I.4 Form including textareas, password boxes and checkboxes. 1376
I.5 Form including radio buttons and pulldown lists. 1379
I.6 Using internal hyperlinks to make your pages more navigable. 1383
I.7 Picture with links anchored to an image map. 1386
I.8 Using meta to provide keywords and a description. 1388
XXXVI Illustrations
I.9 Web site using two frames—navigation and content. 1390
I.10 Framed Web site with a nested frameset. 1393
J Introduction to XHTML: Part 1 (on CD)
J.1 First XHTML example. 1402
J.2 Validating an XHTML document. (Courtesy of World Wide
Web Consortium (W3C).) 1405
J.3 XHTML validation results. (Courtesy of World Wide
Web Consortium (W3C).) 1406
J.4 Header elements h1 through h6. 1407
J.5 Linking to other Web pages. 1408
J.6 Linking to an e-mail address. 1410
J.7 Placing images in XHTML files. 1411
J.8 Using images as link anchors. 1413
J.9 Inserting special characters into XHTML. 1415
J.10 Nested and ordered lists in XHTML. 1418
K Introduction to XHTML: Part 2 (on CD)
K.1 XHTML table. 1427
K.2 Complex XHTML table. 1430
K.3 Simple form with hidden fields and a textbox. 1433
K.4 Form with textareas, password boxes and checkboxes. 1436
K.5 Form including radio buttons and drop-down lists. 1439
K.6 Using internal hyperlinks to make pages more easily navigable. 1443
K.7 Image with links anchored to an image map. 1446
K.8 Using meta to provide keywords and a description. 1448
K.9 Web document containing two frames—navigation and content. 1450
K.10 XHTML document displayed in the left frame of Fig. K.5. 1453
K.11 Framed Web site with a nested frameset. 1455
K.12 XHTML table for Exercise K.7. 1460
K.13 XHTML table for Exercise K.8. 1461
L HTML/XHTML Special Characters
L.1 XHTML special characters. 1462
M HTML/XHTML Colors
M.1 HTML/XHTML standard colors and hexadecimal RGB values. 1463
M.2 XHTML extended colors and hexadecimal RGB values. 1464
N Crystal Reports® for Visual Studio .NET
N.1 Report expert choices. (Courtesy Crystal Decisions) 1467
N.2 Expert formatting menu choices. (Courtesy of Crystal Decisions) 1468
N.3 Crystal Reports designer interface. (Courtesy of Crystal Decisions) 1469
 
آخرین ویرایش:

saalek110

Well-Known Member
Apress.Beginning.C.Sharp.2005.Databases.From.Novice.to.Professional.Dec.2006.pdf

این کتاب اومده در سایت pdfchm .
در حال دانلودم. 13 مگا.

کد:
h*t*t*p://w*w*w.pdfchm.com/book/beginning-c-2005-databases-from-novice-to-professional-7973/27981/

چون سایت غیر مجاز است لینک را با چند ستاره داخل کد گذاشتم.

====================
دانلود شد.

c1.gif

فهرست :

کد:
Contents at a Glance
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
nCHAPTER 1 Getting Our Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
nCHAPTER 2 Getting to Know Our Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
nCHAPTER 3 Introducing SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
nCHAPTER 4 Introducing ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
nCHAPTER 5 Introducing Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
nCHAPTER 6 Introducing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
nCHAPTER 7 Introducing Data Readers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
nCHAPTER 8 Introducing Datasets and Data Adapters. . . . . . . . . . . . . . . . . . . . . . . 171
nCHAPTER 9 Introducing Data Binding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
nCHAPTER 10 Understanding Tables and Relationships . . . . . . . . . . . . . . . . . . . . . . 251
nCHAPTER 11 Learning More About Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
nCHAPTER 12 Using Stored Procedures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
nCHAPTER 13 Handling Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
nCHAPTER 14 Using Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
nCHAPTER 15 Working with ADO.NET Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
nCHAPTER 16 Working with Text and Binary Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
nCHAPTER 17 Using XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
nCHAPTER 18 Introducing LINQ. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
nINDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487

فهرست مشروح:
کد:
nCHAPTER 1 Getting Our Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Installing VCSE and SSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Installing SSMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Installing the SQL Server Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Installing a Sample Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Installing the Northwind Creation Script . . . . . . . . . . . . . . . . . . . . . . . 10
Creating the Northwind Sample Database . . . . . . . . . . . . . . . . . . . . . 12
Uninstalling the Northwind Creation Script . . . . . . . . . . . . . . . . . . . . . 14
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
nCHAPTER 2 Getting to Know Our Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Using SSMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Configuring VCSE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Using BOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
nCHAPTER 3 Introducing SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
What Is SQL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Retrieving Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Performing Simple Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Using the WHERE Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Sorting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Inserting Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Updating Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
vii
Deleting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
T-SQL Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Numeric Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Money Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Character String Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Date and Time Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Binary Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Other Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Data Type Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
nCHAPTER 4 Introducing ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Why ADO.NET?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
From ADO to ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
ADO.NET Isn’t a New Version of ADO . . . . . . . . . . . . . . . . . . . . . . . . . . 66
ADO.NET and the .NET Base Class Library . . . . . . . . . . . . . . . . . . . . . 67
Understanding ADO.NET Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Using the SQL Server Data Provider . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Using the OLE DB Data Provider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Using the ODBC Data Provider. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Data Providers Are APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
nCHAPTER 5 Introducing Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Introducing the Data Provider Connection Classes . . . . . . . . . . . . . . . . . . . 95
Connecting to SSE with SqlConnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Try It Out: Using SqlConnection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Debugging Connections to SQL Server . . . . . . . . . . . . . . . . . . . . . . . 101
Security and Passwords in SqlConnection . . . . . . . . . . . . . . . . . . . . 102
How to Use SQL Server Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Connection String Parameters for SqlConnection . . . . . . . . . . . . . . 103
Connection Pooling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Improving Your Use of Connection Objects. . . . . . . . . . . . . . . . . . . . . . . . . 105
Using the Connection String in the Connection Constructor. . . . . . 105
Displaying Connection Information . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Try It Out: Displaying Connection Information . . . . . . . . . . . . . . . . . 106
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Connecting to SSE with OleDbConnection . . . . . . . . . . . . . . . . . . . . . . . . . 111
Try It Out: Connecting to SSE with the OLE DB Data Provider . . . . 111
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
nCHAPTER 6 Introducing Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Creating a Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Try It Out: Creating a Command with a Constructor . . . . . . . . . . . . 116
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Associating a Command with a Connection . . . . . . . . . . . . . . . . . . . 118
Try It Out: Setting the Connection Property. . . . . . . . . . . . . . . . . . . . 118
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Assigning Text to a Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Try It Out: Setting the CommandText Property . . . . . . . . . . . . . . . . . 120
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Executing Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Try It Out: Using the ExecuteScalar Method . . . . . . . . . . . . . . . . . . . 122
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Executing Commands with Multiple Results. . . . . . . . . . . . . . . . . . . . . . . . 125
Try It Out: Using the ExecuteReader Method . . . . . . . . . . . . . . . . . . 125
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Executing Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Try It Out: Using the ExecuteNonQuery Method . . . . . . . . . . . . . . . . 128
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Command Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Try It Out: Using Command Parameters . . . . . . . . . . . . . . . . . . . . . . 134
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
The Prepare Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
nCHAPTER 7 Introducing Data Readers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Understanding Data Readers in General . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Try It Out: Looping Through a Result Set. . . . . . . . . . . . . . . . . . . . . . 142
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Using Ordinal Indexers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Try It Out: Using Ordinal Indexers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Using Column Name Indexers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Using Typed Accessor Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Try It Out: Using Typed Accessor Methods . . . . . . . . . . . . . . . . . . . . 153
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Getting Data About Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Try It Out: Getting Information About a Result Set with a
Data Reader. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Getting Data About Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Try It Out: Getting Schema Information . . . . . . . . . . . . . . . . . . . . . . . 161
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Using Multiple Result Sets with a Data Reader . . . . . . . . . . . . . . . . . . . . . 164
Try It Out: Handling Multiple Result Sets . . . . . . . . . . . . . . . . . . . . . . 165
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
nCHAPTER 8 Introducing Datasets and Data Adapters. . . . . . . . . . . . . . . . . 171
Understanding the Object Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Datasets vs. Data Readers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
A Brief Introduction to Datasets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
A Brief Introduction to Data Adapters. . . . . . . . . . . . . . . . . . . . . . . . . 174
A Brief Introduction to Data Tables, Data Columns,
and Data Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Working with Datasets and Data Adapters . . . . . . . . . . . . . . . . . . . . . . . . . 176
Try It Out: Populating a Dataset with a Data Adapter . . . . . . . . . . . 177
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Filtering and Sorting in a Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Try It Out: Dynamically Filtering and Sorting Data
in a Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Comparing FilterSort to PopDataSet. . . . . . . . . . . . . . . . . . . . . . . . . . 187
Using Data Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Try It Out: Refining Data with a Data View . . . . . . . . . . . . . . . . . . . . 188
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Modifying Data in a Dataset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Try It Out: Modifying a Data Table in a Dataset . . . . . . . . . . . . . . . . 192
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Propagating Changes to a Data Source. . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
UpdateCommand Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Try It Out: Propagating Dataset Changes to a Data Source . . . . . . 197
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
InsertCommand Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Try It Out: Propagating New Dataset Rows to a Data Source . . . . 202
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
DeleteCommand Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Try It Out: Propagating New Dataset Rows to a Data Source . . . . 208
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Command Builders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Try It Out: Using SqlCommandBuilder . . . . . . . . . . . . . . . . . . . . . . . . 213
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Using Datasets and XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Try It Out: Extracting a Dataset to an XML File . . . . . . . . . . . . . . . . . 218
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Using Data Tables Without Datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Try It Out: Populating a Data Table with a Data Adapter. . . . . . . . . 222
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Understanding Typed and Untyped Datasets . . . . . . . . . . . . . . . . . . . . . . . 225
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
nCHAPTER 9 Introducing Data Binding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
What’s Data Binding? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Performing Simple Data Binding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Try It Out: Using Simple Data Binding . . . . . . . . . . . . . . . . . . . . . . . . 228
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Performing Complex Data Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Try It Out: Using Complex Data Binding. . . . . . . . . . . . . . . . . . . . . . . 231
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Understanding Data Binding: Behind the Scenes . . . . . . . . . . . . . . . . . . . 238
Synchronizing Controls with a Data Source . . . . . . . . . . . . . . . . . . . . . . . . 240
Try It Out: Using a Binding Manager. . . . . . . . . . . . . . . . . . . . . . . . . . 241
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Updating from a Data Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Try It Out: Updating a Table Using a Data Grid . . . . . . . . . . . . . . . . . 245
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
nCHAPTER 10 Understanding Tables and Relationships . . . . . . . . . . . . . . . . 251
Managing Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Creating Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Creating a Table with SSMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Creating a Table with SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Dropping Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Dropping a Table with SSMSE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Dropping a Table with SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Relationships Between Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Understanding Keys. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Data Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Entity Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Referential Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Testing Entity and Referential Integrity . . . . . . . . . . . . . . . . . . . . . . . 269
Normalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
CHAPTER 11 Learning More About Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
More SQL Query Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
DISTINCT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Subqueries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
GROUP BY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Other Aggregates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Datetime Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
CASE Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Joins. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
nCHAPTER 12 Using Stored Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
Creating Stored Procedures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
Try It Out: Creating and Executing a Trivial Stored Procedure. . . . 313
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Try It Out: Creating a Stored Procedure with an
Input Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
Try It Out: Creating a Stored Procedure with an
Output Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
Modifying Stored Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
Try It Out: Modifying Our Trivial Stored Procedure. . . . . . . . . . . . . . 322
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
Deleting Stored Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Try It Out: Deleting Our Trivial Stored Procedure . . . . . . . . . . . . . . . 324
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
Working with Stored Procedures in C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
Try It Out: Executing a Stored Procedure with
No Input Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
Try It Out: Executing a Stored Procedure with Parameters . . . . . . 328
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
CHAPTER 13 Handling Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Handling ADO.NET Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Try It Out: Handling an ADO.NET Exception (Part 1) . . . . . . . . . . . . 335
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Try It Out: Handling an ADO.NET Exception (Part 2) . . . . . . . . . . . . 341
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
Handling Database Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Try It Out: Handling a Database Exception (Part 1):
RAISERROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Try It Out: Handling a Database Exception (Part 2):
Stored Procedure Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Try It Out: Handling a Database Exception (Part 3):
Errors Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
nCHAPTER 14 Using Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
When to Use Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
Understanding ACID Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
How to Code Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
Coding Transactions in T-SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
Coding Transactions in ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
Suggestions for Further Study. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
nCHAPTER 15 Working with ADO.NET Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
Understanding Events and Delegates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
Adding and Removing Event Handlers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
Raising and Handling ADO.NET Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
Working with Connection Object Events . . . . . . . . . . . . . . . . . . . . . . 381
Working with RowUpdate Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
Working with Multiple Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
CHAPTER 16 Working with Text and Binary Data. . . . . . . . . . . . . . . . . . . . . . . 403
Understanding SQL Server Text and Binary Data Types. . . . . . . . . . . . . . 403
Storing Images in a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Try It Out: Loading Image Binary Data from Files . . . . . . . . . . . . . . 405
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
Rerunning the Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
Retrieving Images from a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
Try It Out: Displaying Stored Images . . . . . . . . . . . . . . . . . . . . . . . . . 412
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Working with Text Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
Try It Out: Loading Text Data from a File. . . . . . . . . . . . . . . . . . . . . . 419
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Retrieving Data from Text Columns . . . . . . . . . . . . . . . . . . . . . . . . . . 425
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
nCHAPTER 17 Using XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
What Is XML? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
Understanding XML Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
Understanding the XML Declaration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
Using FOR XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
Try It Out: Creating Some Sample Data . . . . . . . . . . . . . . . . . . . . . . . 435
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Try It Out: Using FOR XML RAW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Try It Out: Using FOR XML AUTO. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
Try It Out: Using FOR XML AUTO Again . . . . . . . . . . . . . . . . . . . . . . . 441
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
Using OPENXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
Try It Out: Using OPENXML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
Try It Out: Generating an Edge Table . . . . . . . . . . . . . . . . . . . . . . . . . 447
How It Works. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
nCONTENTS xv
Using the XML Data Type. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
Try It Out: Creating a Table to Store XML . . . . . . . . . . . . . . . . . . . . . 450
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
Try It Out: Storing and Retrieving XML Documents . . . . . . . . . . . . . 450
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
Try It Out: Using OPENXML with XML Columns . . . . . . . . . . . . . . . . 452
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
Try It Out: Using an Element-Centric Schema with OPENXML. . . . 454
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
nCHAPTER 18 Introducing LINQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
What Is LINQ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Installing LINQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Using LINQ to SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466
Try It Out: Coding a Simple LINQ to SQL Query . . . . . . . . . . . . . . . . 467
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
Try It Out: Using the where Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
Try It Out: Using the orderby Clause. . . . . . . . . . . . . . . . . . . . . . . . . . 473
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
Using LINQ to DataSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
Try It Out: Coding a Simple LINQ to DataSet Query . . . . . . . . . . . . . 476
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478
Try It Out: Using LINQ to DataSet with a Typed Dataset . . . . . . . . . 479
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
nINDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487

توضیحات اول کتاب راجع به محتویات آن:
کد:
Every program manipulates data. Most real-world programs use data stored in relational
databases, so every C# programmer needs to know how to access relational data.
This book explains how to do this in C#, with ADO.NET and Language-Integrated Query
(LINQ), against SQL Server 2005. The same principles and techniques apply to C# programming
against other relational database management systems, such as DB2, MySQL,
Oracle, and PostgreSQL, so what you learn here is valuable whatever database you use.
Who Is This Book For?
This book is for anyone interested in how to access relational data with C#. Only a bit of
experience with C# is assumed, and no prior experience with relational database or the
relational database language SQL is required. We cover all fundamentals carefully and in
an order we believe leads easily from one topic to another, building knowledge and experience
as you progress through the book. So, chapters are best read in sequence.
What Does This Book Cover?
This book covers all the fundamentals of relational databases and ADO.NET that every
C# programmer needs to know and understand. These concepts and techniques are the
foundation for all database programming. Even if you never learn anything else, by the
end of the book you’ll be able to handle the vast majority of real-world database applications
in a professional way. The chapters progress as follows.


در رپیدشیر هم آپلود کردم:
http://rapidshare.com/files/41160020/beginning-c-2005-databases-from-novice-to-professional.rar.html
زیپ شده : 8 و نیم مگا.
در CD هم رایت می کنم. هر وقت رپیدشیر دیلت کرد با پیام خصوصی اطلاع دهید تا دوباره آپلود کنم.
 
آخرین ویرایش:

saalek110

Well-Known Member
http://forum.p30world.com/forumdisplay.php?f=81&order=desc

این یک تالار مخصوص معرفی کتاب است.
بد نیست یک گشتی اینجا بزنید.


=======================
مثلا از این تاپیکش :
http://forum.p30world.com/showthread.php?t=129002
کتاب زیر را. من مشغول دانلودم.

Sams Teach Yourself XML in 21 Days, Third Edition
5ysnjf5.jpg

حجم : حدود 5 مگا.
این کتاب را هم روی CD رایت کردم. اگر دیلت شد با پیام خصوصی بگید در آن تاپیک لینکش را نو کنم.
فهرست:
کد:
[CENTER][IMG]http://saalek110.250free.com/gifs2/a4/c4.gif[/IMG][/CENTER]

Sams Teach Yourself XML in 21 Days, Third Edition 
By Steven Holzner 
   
Publisher : Sams Publishing 
Pub Date : October 14, 2003 
ISBN : 0-672-32576-4 
Pages : 888 




Sams Teach Yourself XML in 21 Days, written by expert author Steve Holzner,
 offers hundreds of real-world examples demonstrating
 the uses of XML and the newest tools developers need to make the most of it.
 In Week One, he starts from basic syntax, and discusses XML document structure, document types,
 and the benefits of XML Schema. 
Week Two covers formatting using either CSS or the Extensible Sytlesheet Language, 
and working with XHTML and other tools for presenting XML data on the Web,
 or in multimedia applications. 
The final chapter of week two discusses XForms, the newest way to process forms in XML applications. 
Week Three applies XML to programming with Java, .NET 
or JavaScript, and building XML into database or Web Service applications with SOAP. Along the way,
 Steve shows readers the results of every lesson
 and provides both the "how" and "why" of the inner working of XML technologies.
 
آخرین ویرایش:

saalek110

Well-Known Member
چند کتاب که فکر می کنم همه ویژوال سی دات نت 2003 باشه را برای سارا خانم که این زبان را کار می کند را آپلود می کنم. البته شاید قبلا در تاپیک ((كار با بانك اطلاعاتي در c++.net)) لینک دادم و ایشان دانلود کرده باشد ولی در این تاپیک پست نزده بودم که حالا می زنم.
بسته زیر شامل 4 کتاب و یک سری سورس است. حجمش قبل زیپ کردن حدود 40 مگا بود که بعد زیپ شد 23 و نیم مگا.
این بسته را هم روی Cd رایت می کنم. اگر بعد چند ماه دیلت شد با پیام خصوصی بگید تا دوباره آپلود کنم.
بعدا اگر شد فهرست 4 کتاب را هم در این پست اضافه می کنم.


c5.gif


آن کتاب که اسمش یک شماره است را عکسش را در زیر می آورم:

c6.gif



http://rapidshare.com/files/41734438/vc_net_2003.rar.html
حجم دانلود : 24 و نیم مگا
 
آخرین ویرایش:

sara_she

Member
سلام
ممنون از اين همه فعاليت و همكاري در ارائه آنچه خود مي دانيد

مي خواستم كتاب visual basic.net رو كه به نقل از بابك تو پست 14گذاشته بوديد دانلود كنم ولي مي نوشت file not found

پست 17 هم نتونستم دانلود كنم چون بعد از انتخاب free هيچ اتفاقي نمي افتاد
 
آخرین ویرایش:

saalek110

Well-Known Member
نقل از :
http://www.itonline.ir/
-----------------------------------

وقتی که Rapidshare ایجاد شد به سرعت به دلیل امکانات ویژه ای که در اختیار کاربرانش قرار می داد معروف شد. آپلود آسان و راحت کردن کاربران از مراحل پردردسر ثبت نام و از همه مهمتر امکان آپلود و دانلود فایل های حجیم همگی از ویژگی های خاصی بود که سبب محبوبیت این سایت شد ولی از طرفی محدودیت هایی که این سایت برای دانلود (عدم امکان استفاده از برنامه های مدیریت دانلود و محدودیت دانلود برای هر IP ) باعث شد که سایت های مشابه ای ساخته شوند که همگی همان ایده اولیه فراهم کردن امکان آپلود آسان و حجیم را برای همه را داشتند که از میان این خیل عظیم سایت ها می توان Divshare را به عنوان یک نمونه موفق نام برد.

سایتی که امروز معرفی می شود ohShare نام دارد. حداکثر حجم فایل 80 مگابایت است و در صورت دانلود نشدن در یک بازه سی روزه ، فایل از سیستم پاک می شود. نقطه قوت این سایت را می توان به امکان استفاده از برنامه های مدیریت دانلود عنوان کرد. در ضمن سایت اجازه آپلود فایل های PHP ، CGI ، PL و HTML را نمی دهد.

سایت خوب و سبکی است و من برای دانلود کردن فایل از آن به مشکل خاصی برنخوردم.
سلام.

سلام

پست 17 نتونستم دانلود كنم چون بعد از انتخاب free هيچ اتفاقي نمي افتاد

من الان زدم مشکلی ندارد.
سایت رپیدشیر خیلی قوائد دارد. احتمالا کامپیوتر شما یکی از شرایط را ندارد. یا اشتباها داره برخورد می کنه.
در اینجا پست 17 را آپلود کردم:
http://divshare.com/download/1205751-015
 
آخرین ویرایش:

saalek110

Well-Known Member
http://rapidshare.com/files/4253044...eginning-from-novice-to-professional.rar.html
-------------------------------------------------
Beginning VB 2005
Databases
From Novice to Professional

10 مگا حدودا.

کد:
Contents
About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv
■CHAPTER 1 Getting Our Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Installing VBE and SSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Installing SSMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Installing the SQL Server Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Installing a Sample Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Installing the Northwind Creation Script . . . . . . . . . . . . . . . . . . . . . . . 10
Creating the Northwind Sample Database . . . . . . . . . . . . . . . . . . . . . 12
Uninstalling the Northwind Creation Script . . . . . . . . . . . . . . . . . . . . . 14
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
■CHAPTER 2 Getting to Know Our Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Using SSMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Configuring VBE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Using BOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
■CHAPTER 3 Introducing SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
What Is SQL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Retrieving Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Using the WHERE Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Sorting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Inserting Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
vii
Updating Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Deleting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
T-SQL Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Numeric Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Money Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Character String Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Date and Time Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Binary Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Other Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Data Type Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
■CHAPTER 4 Introducing ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Why ADO.NET?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
From ADO to ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
ADO.NET Isn’t a New Version of ADO . . . . . . . . . . . . . . . . . . . . . . . . . . 68
ADO.NET and the .NET Base Class Library . . . . . . . . . . . . . . . . . . . . . 69
Understanding ADO.NET Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Using the SQL Server Data Provider . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Using the OLE DB Data Provider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Using the ODBC Data Provider. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Data Providers Are APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
■CHAPTER 5 Introducing Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Introducing the Data Provider Connection Classes . . . . . . . . . . . . . . . . . . . 97
Connecting to SSE with SqlConnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Try It Out: Using SqlConnection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Debugging Connections to SQL Server . . . . . . . . . . . . . . . . . . . . . . . 103
Security and Passwords in SqlConnection . . . . . . . . . . . . . . . . . . . . 104
How to Use SQL Server Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Connection String Parameters for SqlConnection . . . . . . . . . . . . . . 105
Connection Pooling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
viii ■CONTENTS
Improving Your Use of Connection Objects. . . . . . . . . . . . . . . . . . . . . . . . . 107
Using the Connection String in the Connection Constructor. . . . . . 107
Displaying Connection Information . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Try It Out: Displaying Connection Information . . . . . . . . . . . . . . . . . 108
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Connecting to SSE with OleDbConnection . . . . . . . . . . . . . . . . . . . . . . . . . 112
Try It Out: Connecting to SSE with the OLE DB Data Provider . . . . 113
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
■CHAPTER 6 Introducing Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Creating a Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Try It Out: Creating a Command with a Constructor . . . . . . . . . . . . 118
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Associating a Command with a Connection . . . . . . . . . . . . . . . . . . . 119
Assigning Text to a Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Executing Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Try It Out: Using the ExecuteScalar Method . . . . . . . . . . . . . . . . . . . 123
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Executing Commands with Multiple Results. . . . . . . . . . . . . . . . . . . . . . . . 126
Try It Out: Using the ExecuteReader Method . . . . . . . . . . . . . . . . . . 126
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Executing Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Try It Out: Using the ExecuteNonQuery Method . . . . . . . . . . . . . . . . 129
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Command Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Try It Out: Using Command Parameters . . . . . . . . . . . . . . . . . . . . . . 134
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
The Prepare Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
■CONTENTS ix
■CHAPTER 7 Introducing Data Readers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Understanding Data Readers in General . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Try It Out: Looping Through a Result Set. . . . . . . . . . . . . . . . . . . . . . 142
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Using Ordinal Indexers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Try It Out: Using Ordinal Indexers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Using Column Name Indexers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Using Typed Accessor Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Try It Out: Using Typed Accessor Methods . . . . . . . . . . . . . . . . . . . . 152
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Getting Data About Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Try It Out: Getting Information About a Result Set with
a Data Reader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Getting Data About Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Try It Out: Getting Schema Information . . . . . . . . . . . . . . . . . . . . . . . 161
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Using Multiple Result Sets with a Data Reader . . . . . . . . . . . . . . . . . . . . . 164
Try It Out: Handling Multiple Result Sets . . . . . . . . . . . . . . . . . . . . . . 165
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
■CHAPTER 8 Introducing Datasets and Data Adapters. . . . . . . . . . . . . . . . . 169
Understanding the Object Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Datasets vs. Data Readers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
A Brief Introduction to Datasets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
A Brief Introduction to Data Adapters. . . . . . . . . . . . . . . . . . . . . . . . . 172
Working with Datasets and Data Adapters . . . . . . . . . . . . . . . . . . . . . . . . . 174
Try It Out: Populating a Dataset with a Data Adapter . . . . . . . . . . . 174
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Filtering and Sorting in a Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Modifying Data in a Dataset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Propagating Changes to a Data Source . . . . . . . . . . . . . . . . . . . . . . . 191
Concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
x ■CONTENTS
Using Datasets and XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Try It Out: Extracting a Dataset to an XML File . . . . . . . . . . . . . . . . . 212
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Using Data Tables Without Datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Try It Out: Populating a Data Table with a Data Adapter. . . . . . . . . 215
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Understanding Typed and Untyped Datasets . . . . . . . . . . . . . . . . . . . . . . . 218
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
■CHAPTER 9 Introducing Data Binding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
What’s Data Binding? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Performing Simple Data Binding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Try It Out: Using Simple Data Binding . . . . . . . . . . . . . . . . . . . . . . . . 222
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Performing Complex Data Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Try It Out: Using Complex Data Binding. . . . . . . . . . . . . . . . . . . . . . . 225
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Understanding Data Binding: Behind the Scenes . . . . . . . . . . . . . . . . . . . 230
Synchronizing Controls with a Data Source . . . . . . . . . . . . . . . . . . . . . . . . 231
Try It Out: Using a Binding Manager. . . . . . . . . . . . . . . . . . . . . . . . . . 232
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Updating from a Data Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Try It Out: Updating a Table Using a Data Grid . . . . . . . . . . . . . . . . . 236
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
■CHAPTER 10 Understanding Tables and Relationships . . . . . . . . . . . . . . . . 243
Managing Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Creating Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Creating a Table with SSMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Creating a Table with SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Dropping Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Dropping a Table with SSMSE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Dropping a Table with SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
■CONTENTS xi
Relationships Between Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Understanding Keys. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Data Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Entity Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Referential Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Testing Entity and Referential Integrity . . . . . . . . . . . . . . . . . . . . . . . 259
Normalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
■CHAPTER 11 Learning More About Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
More SQL Query Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
DISTINCT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Try It Out: Querying Using DISTINCT. . . . . . . . . . . . . . . . . . . . . . . . . . 268
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Subqueries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
IN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Try It Out: Using the IN Predicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Try It Out: Using the NOT IN Predicate . . . . . . . . . . . . . . . . . . . . . . . . 272
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Try It Out: Using a Function with the IN Predicate . . . . . . . . . . . . . . 274
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
GROUP BY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Try It Out: Using the GROUP BY Clause . . . . . . . . . . . . . . . . . . . . . . . 275
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Other Aggregates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Try It Out: Using the MIN, MAX, and AVG Functions . . . . . . . . . . . . 277
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Datetime Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Try It Out: Using T-SQL Date and Time Functions . . . . . . . . . . . . . . 278
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
xii ■CONTENTS
CASE Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Simple CASE Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Try It Out: Using a Simple CASE Expression . . . . . . . . . . . . . . . . . . . 280
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Try It Out: Using a More Complex CASE Expression . . . . . . . . . . . . 282
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Searched CASE Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Try It Out: Using a Searched CASE Expression . . . . . . . . . . . . . . . . . 284
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Joins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Inner Joins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Try It Out: Writing an Inner Join. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Try It Out: Writing an Inner Join Using Correlation Names . . . . . . . 289
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Try It Out: Writing an Inner Join Using Correlation Names
and Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Try It Out: Coding an Inner Join Using Original Syntax . . . . . . . . . . 292
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Try It Out: Writing an Inner Join of Three Tables . . . . . . . . . . . . . . . 294
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Outer Joins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Try It Out: Adding an Employee with No Orders . . . . . . . . . . . . . . . . 296
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Try It Out: Using LEFT OUTER JOIN. . . . . . . . . . . . . . . . . . . . . . . . . . . 297
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Other Joins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
■CONTENTS xiii
■CHAPTER 12 Using Stored Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Creating Stored Procedures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Try It Out: Creating and Executing a Trivial Stored Procedure. . . . 302
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Try It Out: Creating a Stored Procedure with an Input
Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
Try It Out: Creating a Stored Procedure with an Output
Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Modifying Stored Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Try It Out: Modifying Our Trivial Stored Procedure. . . . . . . . . . . . . . 311
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
Deleting Stored Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
Try It Out: Modifying Our Trivial Stored Procedure. . . . . . . . . . . . . . 313
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Working with Stored Procedures in Visual Basic . . . . . . . . . . . . . . . . . . . . 314
Try It Out: Executing a Stored Procedure with No Input
Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Try It Out: Executing a Stored Procedure with Parameters . . . . . . 317
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
■CHAPTER 13 Handling Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
Handling ADO.NET Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
Try It Out: Handling an ADO.NET Exception (Part 1) . . . . . . . . . . . . 323
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
Try It Out: Handling an ADO.NET Exception (Part 2) . . . . . . . . . . . . 328
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
xiv ■CONTENTS
Handling Database Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Try It Out: Handling a Database Exception (Part 1):
RAISERROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Try It Out: Handling a Database Exception (Part 2):
Stored Procedure Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
Try It Out: Handling a Database Exception (Part 3):
Errors Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
■CHAPTER 14 Using Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
When to Use Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Understanding ACID Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Coding Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Coding Transactions in T-SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Coding Transactions in ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
Suggestions for Further Study. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
■CHAPTER 15 Working with ADO.NET Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Understanding Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Adding and Removing Event Handlers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Raising and Handling ADO.NET Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Working with Connection Object Events . . . . . . . . . . . . . . . . . . . . . . 366
Working with RowUpdate Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Working with Multiple Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
■CONTENTS xv
xvi ■CONTENTS
■CHAPTER 16 Working with Text and Binary Data. . . . . . . . . . . . . . . . . . . . . . . 387
Understanding SQL Server Text and Binary Data Types. . . . . . . . . . . . . . 387
Storing Images in a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
Try It Out: Loading Image Binary Data from Files . . . . . . . . . . . . . . 389
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
Rerunning the Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Retrieving Images from a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Try It Out: Displaying Stored Images . . . . . . . . . . . . . . . . . . . . . . . . . 395
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Working with Text Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
Try It Out: Loading Text Data from a File. . . . . . . . . . . . . . . . . . . . . . 400
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Retrieving Data from Text Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
Try It Out: Retrieving Text Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
■CHAPTER 17 Using XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
What is XML? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
Understanding XML Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
Understanding the XML Declaration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
Using FOR XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
Try It Out: Creating Some Sample Data . . . . . . . . . . . . . . . . . . . . . . . 415
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Try It Out: Using FOR XML RAW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
Try It Out: Using FOR XML AUTO. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
Try It Out: Using FOR XML AUTO Again . . . . . . . . . . . . . . . . . . . . . . . 420
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Using OPENXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
Try It Out: Using OPENXML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
Try It Out: Generating an Edge Table . . . . . . . . . . . . . . . . . . . . . . . . . 427
How It Works. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
Using the XML Data Type. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
Try It Out: Creating a Table to Store XML . . . . . . . . . . . . . . . . . . . . . 429
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
Try It Out: Storing and Retrieving XML Documents . . . . . . . . . . . . . 430
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
Try It Out: Using OPENXML with XML Columns . . . . . . . . . . . . . . . . 432
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
Try It Out: Using an Element-centric Schema with OPENXML . . . . 434
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
■CHAPTER 18 Introducing LINQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
What Is LINQ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
Installing LINQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Using LINQ to SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
Try It Out: Coding a Simple LINQ to SQL Query . . . . . . . . . . . . . . . . 444
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
Try It Out: Using the Where Clause. . . . . . . . . . . . . . . . . . . . . . . . . . . 449
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
Try It Out: Using the Order By Clause. . . . . . . . . . . . . . . . . . . . . . . . . 450
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
Using LINQ to DataSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
Try It Out: Coding a Simple LINQ to DataSet Query . . . . . . . . . . . . . 453
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Try It Out: Using LINQ to DataSet with a Typed Dataset . . . . . . . . . 456
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
■CONTENTS xvii
 
آخرین ویرایش:

جدیدترین ارسال ها

بالا