Title page 1 Use this page to introduce the product by This is "Title Page 1" - you may use this page to introduce your product, show title, author, copyright, company logos, etc.. Whil
Trang 1© 2004 Your company
Standard print manual template
Trang 2Title page 1 Use this page to introduce the product
by <AUTHOR>
This is "Title Page 1" - you may use this page to introduce
your product, show title, author, copyright, company logos,
etc.
This page intentionally starts on an odd page, so that it is on
the right half of an open book from the readers point of
view This is the reason why the previous page was blank
(the previous page is the back side of the cover)
Trang 3All rights reserved No parts of this work may be reproduced in any form or by any means - graphic, electronic, or mechanical, including photocopying, recording, taping, or information storage and retrieval systems - without the written permission of the publisher
Products that are referred to in this document may be either trademarks and/or registered trademarks of the
respective owners The publisher and the author make no claim to these trademarks
While every precaution has been taken in the preparation of this document, the publisher and the author assume no responsibility for errors or omissions, or for damages resulting from the use of information contained in this document
or from the use of programs and source code that may accompany it In no event shall the publisher and the author be liable for any loss of profit or any other commercial damage caused or alleged to have been caused directly or
indirectly by this document
Printed: September 2004 in (whereever you are located)
Mastering C# Database Programming
@Team LiB
© 2004 Your company
Publisher Special thanks to:
All the people who contributed to this document, to mum and dad and grandpa, to my sisters and brothers and mothers in law, to our secretary Kathrin, to the graphic artist who created this great product logo on the cover page (sorry, don't remember your name
at the moment but you did a great work), to the pizza service down the street (your daily Capricciosas saved our lives), to the copy shop where this document will be duplicated, and and and Last not least, we want to thank EC Software who wrote this great help tool called HELP & MANUAL which printed this document.
Managing Editor
Technical Editors
Cover Designer
enter name
enter name
enter name
enter name
enter name
Production
enter name
Team Coordinator
enter name
Trang 4Table of Contents
9
1 How to Use This Book
11
2 Downloading the Example Programs
Part V Part 1: Introduction to ADO.NET and
13
1 Chapter 1: Introduction to Database Programming with ADO.NET
13 Obtaining the Required Software
14 Developing Your First ADO.NET Program
17 Connecting to Access and Oracle Databases
19 Introducing Visual Studio NET
23 Using the NET Documentation
25 Using the SQL Server Documentation
26 Summary
26
2 Chapter 2: Introduction to Databases
27 Introducing Databases
28 Using SQL Server
34 Exploring the Northwind Database
43 Building Queries Using Enterprise Manager
45 Creating a Table
50 Summary
51
3 Chapter 3: Introduction to Structured Query Language (SQL)
51 Using SQL
70 Accessing a Database Using Visual Studio NET
73 Summary
73
4 Chapter 4: Introduction to Transact-SQL Programming
74 Fundamentals of Transact-SQL
77 Using Cursors
78 Using Functions
86 Creating User-Defined Functions
89 Introducing Stored Procedures
91 Introducing Triggers
94 Summary
94
5 Chapter 5: Overview of the ADO.NET Classes
95 The Managed Provider and Generic Data Set Classes
98 Performing a SQL SELECT Statement and Storing the Rows Locally
102 Summary
Mastering C# Database Programming @Team LiB
I
© 2004 Your company
Trang 5102
6 Chapter 6: Introducing Windows Applications and ADO.NET
103 Developing a Simple Windows Application
109 Using Windows Controls
110 Using a DataGrid Control to Access a Database
116 Using the Data Form Wizard to Create a Windows Form
124 Summary
Part VI Part 2: Fundamental Database Programming
126
1 Chapter 7: Connecting to a Database
126 Understanding the SqlConnection Class
128 Using a SqlConnection Object to Connect to a SQL Server Database
132 Creating a Connection Object Using Visual Studio NET
137 Summary
138
2 Chapter 8: Executing Database Commands
138 The SqlCommand Class
140 Creating a SqlCommand Object
141 Executing SELECT Statements and TableDirect Commands
149 Executing Commands that Modify Information in the Database
151 Introducing Transactions
152 Supplying Parameters to Commands
156 Executing SQL Server Stored Procedures
160 Creating a Command Object Using Visual Studio NET
161 Summary
162
3 Chapter 9: Using DataReader Objects to Read Results
162 The SqlDataReader Class
165 Creating a SqlDataReader Object
165 Reading Rows from a SqlDataReader Object
167 Returning Strongly Typed Column Values
168 Using the Get* Methods to Read Column Values
170
An Example of Using the Get* Methods
177 Reading Null Values
177 Executing Multiple SQL Statements
179 Using a DataReader Object in Visual Studio NET
181 Summary
182
4 Chapter 10: Using Dataset Objects to Store Data
182 The SqlDataAdapter Class
185 The DataSet Class
195 Writing and Reading XML Using a DataSet Object
198 Mapping Tables and Columns
199 Reading a Column Value Using Strongly Typed DataSet Classes
203 Creating a DataAdapter Object Using Visual Studio NET
207 Creating a DataSet Object Using Visual Studio NET
208 Summary
208
5 Chapter 11: Using DataSet Objects to Modify Data
209 The DataTable Class
211 The DataRow Class
212 The DataColumn Class
213 Adding Restrictions to DataTable and DataColumn Objects
221 Finding, Filtering, and Sorting Rows in a DataTable
223 Modifying Rows in a DataTable
II Contents
II
© 2004 Your company
Trang 6Endnotes 2 (after index)
Mastering C# Database Programming @Team LiB
376
© 2004 Your company
Trang 7Back Cover