aborted transactions, 747
AcceptChanges and RejectChanges Methods of a DataSet (code listing), 191–192
AcceptChanges method, 127, 191–192, 231
Access, Microsoft
accessing databases, 378–380
exporting table to text file, 383–385
Active Data Objects .NET (ADO.NET). See ADO.NET
ActiveX Data Objects Multi-Dimensional Library (ADOMD), 718
Add Button Click Event Handler (code listing), 505
Add Web Reference feature, 525
AddCat1Stored Procedure (code listing), 404
AddHandler statement, 209
adding data (ASP.NET), 505
AddNew method (DataView), 130
AddRowBtn_Click Method (code listing), 109–110
administration queues (user), 726
ADO (ActiveX Data Objects)
comparing with ADO.NET, 11–13
connections and disconnected data, 11–12
RecordSets vs. DataSets, 12
XML support, 12–13
overview of, 6
recordset and ADO.NET, 712–716
ADO Examples and Best Practices for Programmers, 760
ADODB Namespace to Access a Database (code listing), 715–716
ADO.NET
ADO.NET Application (code listing), 27
ADO.NET (Apress), 760
ADOX, using with, 716–718
architecture, 75–76
COM interoperability and. See COM interoperability
creating a project, 33
exception handling in. See exception handling in ADO.NET
Frequently Asked Questions. See Frequently Asked Questions, ADO.NET
object-relational (OR) mapping in. See object-relational (OR) mapping in .NET
overview of, 6–7
SQL Server performance and. See SQL Server and ADO.NET
using in XML Web services. See XML Web services
Web application, creating, 478–480
XML, using with, 262–272
displaying XML data in DataSet format, 270
reading XML using DataSet, 262–264
saving data from DataSet to XML, 271–272
writing XML using DataSet, 264–267
XmlDataDocument and DataSet objects, 272
XmlDataDocument and XML, 267–269
ADO.NET basics, 1–31
advantages of, 9–11
managed code, 10
performance and scalability, 11
single object-oriented API, 9–10
visual data components, 11
XML support, 10
code listings
ADO.NET Application, 27
Viewing Data From SQL Server Database, 30–31
comparing with ADO, 11–13
connections and disconnected data, 11–12
RecordSets vs. DataSets, 12
XML support, 12–13
components of, 15–22
Command object, 17–18
CommandBuilder, 19
Connection object, 16–17
data providers, 15–16
DataAdapter object, 19–20
DataSet structure, 20–21
DataSets in DataViews, 21–22
creating simple ADO.NET application, 26–28
DataSet to read data, 28–31
Microsoft Data Access Technologies, overview
ADO, 6
ADO.NET, 6–7
DAO, 4–5
MFC, 5
ODBC, 2–4
OLE DB, 5–6
RDO, 5
namespaces and classes overview, 13–14
overview, 6–8
reasons for design of, 8–9
writing ADO.NET applications, 22–26
choosing .NET providers, 22–23
Command or DataAdapter objects, creating, 25
connections, closing, 26
connections, establishing, 24–25
displaying data, 25–26
Filling data to DataSet or DataReader object, 25
namespace references, adding, 23–24
ADO.NET events, handling, 209–232
code listings
ColumnChanging and ColumnChanged Event Handlers, Writing, 222–223
Connection Events, Writing Code That Executes, 214–215
DataAdapter FillError Event Handler Code, 217
DataAdapter's Fill and Update Methods, Calling, 219–220
DataView Event Handler Caller, 230–231
DataView OnListChanged Event Handler, 230
InfoMessage and StateChange events, Writing Event Handlers for, 213
MergeFailed Event Handler, Calling, 220–221
NodeChanged Event Handler, 228
NodeInserted Event Handler, 229
NodeRemoved Event Handler, 229
RowChanging and RowChanged Event Handlers, Writing, 224
RowDeleting and RowDeleted Event Handlers, Writing, 225–226
RowUpdated Event Handler, 218
RowUpdating Event Handler, 218–219
SqlDataAdapter Event Handler Bodies, 217
XmlDataDocument Event Handling Example, 227–228
Connection events, 211–215
DataAdapter events, 215–220
DataSet events, 220–221
DataTable events, 221–226
DataView and DataViewManager events, 229–231
fundamentals, 209–211
XmlDataDocument events, 226–229
ADO.NET in connected environments, 135–208
code listings
AcceptChanges and RejectChanges methods of a DataSet, Using, 191–192
Calling a DataAdapter's Fill Method, 171
Connecting to SQL Server and Reading SqlConnection Properties, 144–145
Connecting to SQL Server Using OleDb Data Provider, 144
Creating Two Connections with Different Strings, 147–148
DataAdapter's Update Method, Calling, 178
DataColumnMapping, Using, 180–181
DataReader Reads From SQL Server Database, 162–164
DataSet Rows, Adding, Editing, Deleting, 190–191
DataTableMapping to Map Northwind Orders Table, 179
DataTableMapping with Table Option, Using, 179–180
DeleteCommand Property of DataAdapter, Setting, 176
Displaying Customers Table's Data in DataGrid Using SqlDataAdapter, 174–175
Displaying Orders Table Data in DataGrid Using OleDbAdapter, 173–174
ExecuteScalar Method to Retrieve Single Value, 160
Executing Batches Using DataReader, 164–165
Executing Multiple SQL Queries Using SqlTransaction, 207–208
Fill method of a DataAdapter, Calling, 177
Filling Data From Multiple Tables, 188–189
FillSchema method of SqlDataAdapter, Using, 172
INSERT SQL Statement, Adding Records to Table Using, 159
Merging Two DataSet Objects, 189
OleDb Database, Connecting to, 143
OleDbCommand, Using to Access an Access Database, 154
Optimistic Concurrency, 202–203
Parameter, Creating a, 185–186
Pessimistic Concurrency, 204
Private Members, 196–197
ReleaseObjectPool, Calling, 149
Removing a Row and Calling Update Method of DataAdapter, 177
Savepoints in Sql Data Provider, Using, 205–206
Saving Only Modified Rows of DataSet, 193
SELECT Statement, Executing Using OleDbDataAdapter, 167–168
SqlCommand Properties, Setting and Getting, 151
SqlCommand to Read Data from Database, 153
SqlCommandBuilder Class, Creating and Using, 183–184
SqlConnection objects, creating, 139–140
SqlDataAdapter Instances, Creating, 167
SqlDataAdapter Properties, Using, 169
SqlParameter, Creating, 177
Stored Procedure, Calling Using SqlCommand, 155
Stored Procedure, Executing and Reading Results of, 156–157
Stored Procedure Results Output, Adding Subtotal Listing to, 157
Stored Procedure (Sales by Year) in Northwind Database, 156
TableDirect to Read Table, 158
Command objects and executing SQL statements, 150–160
calling stored procedures, 155–157
Command methods, additional, 160
Command properties, 150–151
CommandType enumeration, 154–155
creating Command objects, 151–153
executing Commands, 158–160
OleDbCommand, creating and using, 153–154
TableDirect, 157–158
CommandBuilder object
creating, 182
SqlCommandBuilder members, 182
SqlCommandBuilder, using, 182–184
connecting to data sources, 139–150
connection pooling, 145–149
Connection properties and methods, 140–141
CreateCommand and ChangeDatabase methods, 149–150
creating connections, 139–140
opening and closing connections, 142–145
DataAdapter, 166–181
adding DataTable to DataSet, 172
constructing DataAdapter objects, 166–168
DataAdapter example, 172–175
Filling DataAdapter from RecordSet, 175–176
Filling DataSets, 170–171
methods, 170
properties, 168–169
table and column mapping, 178–181
updating database using Update method, 176–178
DataReader, 160–166
basics, 160–161
Command Behaviors, 165–166
initializing, 161
interpreting batches of queries, 164–165
properties and methods, 161–162
reading with, 162–164
DataSet in connected environments, 188–194
accepting/rejecting changes through DataSet, 191–192
adding, updating, deleting through DataSet, 190–191
DataSet vs. DataReader, 193
fetching data based on wildcard characters, 194
Filling DataSet from multiple tables, 188–189
saving only changed data, 192–193
SQL statement, reading from two or more tables with, 190
DataView in connected environments, 194–208
batches, executing, 206–208
multiple views, creating, 195–197
Rollback, Commit, and Savepoints, 204–206
transactions and concurrency, 198–200
using concurrency, 201–204
using transactions, 200–201
generic data provider model, 135–136
namespaces, importing, 137
parameters, construction of, 184–187
System.SqlClient namespace, 137–139
ADO.NET in disconnected environments, 73–133
architecture, 75–76
basics, 73–74
class hierarchy, 76–80
code listings
AddRowBtn_Click Method, 109–110
Class-Level DataTable and DataSet Variables, 107
ColumnMapping Property of DataColumn, Using, 92
Columns, Creating Using Different DataColumn Constructors, 88–89
Contains, Find, and Remove Method of DataRowCollection, Using, 116
CreateCustomersTable Method, 107–109
Custom Properties, Adding and Removing, 93
Customer/Orders Relationship Example, 102–105
Data Column, Setting as Primary Key, 90
DataColumn, Creating and Setting Properties, 89–90
DataRelation, Creating Customer/Order Relationship Using, 100
DataRow's RejectChanges and Delete Methods, Calling, 98
DataTable Objects, Adding to a DataSet, 124–125
DataTable, Saving in XML Documents, 114
DataView Objects, Creating from a DataTable, 129
DeleteRowsBtn_ClickMethod, 110–112
Form's Constructor Calling CreateCustomersTable, CreateOrdersTable, and BindData, 102
ID and Name Data Columns of Customers Table, Creating, 90
InsertAt and RemoveAt Methods, Using, 116
Merging DataRow and DataTable Objects, 127
Merging Two DataSets, 126–127
Ordinal and MaxLength properties, Using, 94
Removing Column From a Collection, 117
Rows, Adding to DataTable Using DataRow, 96–98
Rows, Editing Using BeginEdit, CancelEdit, and EndEdit methods, 119
Rows, Finding in DataView Using Find Method, 131
Rows of DataView, Adding, Updating, and Deleting, 130
RowState property, Calling, 99
SearchButtonClick Method, 112–113
Select Method, Sorting Data Using, 113–114
Setting and Reading Custom Properties of a DataSet, 123–124
Setting Values of ID, Address, and Name Columns of DataRow, 95
State of a Row, Determining, 118
Table, Creating Using DataTable and DataColumn, 91–92
data providers, choosing, 80
DataSet objects. See DataSet objects
DataTables, 83–119
AddRowBtn_Click Method, 109–110
Class-Level DataTable and DataSet Variables, 107
CreateCustomersTable Method, 107–109
DataColumnCollection class, 116–117
DataColumns. See DataColumns
DataRelations, 99–100
DataRow states and versions, 117–119
DataRowCollection class, 115–116
DataRows, 94–99
DeleteRowsBtn_ClickMethod, 110–112
fundamentals, 83–85
properties and methods, 100–105
Saving DataTable in XML Documents, 114
SearchButtonClick Method, 112–113
Select Method, Sorting Data Using, 113–114
DataView objects, 128–131
DataViewManager, 132
disconnected classes, 81–83
ADOX From Managed Code, Using (code listing), 717–718
ADOX, using with ADO.NET, 716–718
aliases and joins, 806–807
AllowNavigation in Action (code listing), 319
AllowPaging, PageSize, and AllowSorting Properties (code listing), 501
ALTER TABLE SQL Statement, 353
alternating rows, multiple columns, and grid lines, 568–569
AlternatingItemTemplate code, 575
Appending in an XML Document Fragment (code listing), 254
Apple Data Access Language (DAL), 4
applications
building Web. See Web applications, building
writing ADO.NET, 22–26
choosing .NET providers, 22–23
Command or DataAdapter objects, creating, 25
connections, closing, 26
connections, establishing, 24–25
displaying data, 25–26
Filling data to DataSet or DataReader object, 25
namespace references, adding, 23–24
architecture, ADO.NET, 75–76
ASP.NET for database Web applications, 465–516
ADO.NET Web application, creating, 478–480
ASP.NET application development, 468–478
Button Click event handler, writing code on, 477–478
control properties, setting, 474–475
creating new application, 469–472
Document Outline viewer, 475–476
Web controls, adding to Web Form, 472–473
code listings
Add Button Click Event Handler, 505
AllowPaging, PageSize, and AllowSorting Properties, 501
DataGrid's PageStyle Modes, Setting, 501
Deleting Data on Delete Button Click, 507
ExecuteSQL Method, 504
FillDataGrid Method, 503
Filling Data from Database to Data-Bound Controls, 478–480
Filling DatSet from DataAdapter, 498–499
First ASP.NET Application, 486–487
Guest Data, Adding to Database, 510
HTML View of asp:DataGrid, 501
My Home Page and View Guest Book Buttons, 514
PageIndexChanged Handler of DataGrid Control, 500
Page_Load Event Handler Code of ViewGuestBook.aspx, 512–513
Setting Image as DataGrid Control's Next and Previous Page Text, 501
Updating Data on Update Button Click, 506
ViewGuestBook.aspx, opening, 511
data binding in ASP.NET, 487–507
adding data, 505
data-bound server-side controls, 488–489
DataGrid and DataList controls. See DataGrid and DataList controls in ASP.NET
deleting data, 507
updating data, 506
Web Forms, adding, editing, deleting in, 502–504
guest book, creating, 507–515
basics, 507–508
compiling and running, 514–515
default Web Form: MyGuestBook.aspx, 508–511
Web Forms, adding, 511–514
overview of ASP.NET, 465–468
server-side controls, 480–487
HTML server controls, 481
.NET Framework Library and, 483–485
user controls, 483
validation controls, 482–483
Web Forms, adding to, 485–487
Web Forms controls, 485
Web server controls, 481–482
ASP.NET server controls and data binding, 537–608
code listings
Button Click Handlers, Writing, 541
ButtonColumn Click Event Handler, 592
Calendar Control, Getting Selected Date of, 542
Calendar Control's Properties, setting, 544
Data Binding in a DataGrid Control, 583–584
DataGrid Column's Sequence, Rearranging, 588
DataGrid Control, Sorting in, 606–607
DataGrid Control's Style Properties, Setting, 585–586
DataGrid with Button Columns, 593–594
DataList Control, Data Binding in, 564–566
DataList Control's Properties, Setting, 568–569
DataList Control's Styles, Setting, 570–571
DropDownList Control, Data Binding in, 559–560
Editable DataGrid, 601–604
Editable DataList Control, 578–581
Formatting BoundColumn's Header and Footers, 588–589
ListBox Control, Data Binding in, 557–558
Repeater Control, Using, 554–555
Simple Template, Applying on a Repeater Control, 546–547
Template Columns in a DataGrid Control, 596–598
Template Columns, Using, 595–596
Templates, Adding to a DataList Control, 549
Templates of a DataList Control, Adding Formatting to, 550–551
TextBox, Button, and Image Controls, Data Binding in, 561–562
Update, Delete, Cancel, and Edit Command Handlers, Adding, 572
Update, Delete, Cancel, and Edit Command Handlers Code, 573
VisibleMonthChanged Event, 545
complex Web Forms controls, data binding in, 562–607
BaseDataList class, 562–563
DataGrid Web server control. See DataGrid Web server control
DataKeyCollection class, 563
DataList Web server control. See DataList Web server control
data binding in Web Forms, 537–539
simple Web Forms controls, data binding in, 540–562
ASP.NET templates, 547–548
Button control, 540–541
Calendar control, 542–545
DropDownList control, 558–560
ListBox control, 556–558
ListControl class, 555–556
Repeater control, 552–555
templates, Web server control. See templates, Web server control templates
TextBox, Button and Image controls, 560–562
ASP.NET server-side controls, 480–487
adding to Web Forms, 485–487
HTML server controls, 481 .NET Framework Library and, 483–485
user controls, 483
validation controls, 482–483
Web Forms controls, 485
Web server controls, 481–482
ASP.NET syntax, 486
assemblies, defined, 709
atomic values, 780
attributes, defined, 779
Auto Format option (DataGrid), 492–493, 552
AutoGenerateColumns property, 586–587
AutoIncrement columns, creating, 822