C++ exception handling, 359

caching mechanism, near-zero-impact, 706–708

Calendar Control (Web Forms)

Getting Selected Date of (code listing), 542

Properties, Setting (code listing), 544

using, 542–545

Calling a DataAdapter's Fill Method (code listing), 171

Calling DataForm1 from Button Click (code listing), 65

Calling DataForm2 from Button Click (code listing), 66

Calling DataRow's RejectChanges and Delete Methods (code listing), 98

Calling RowState property (code listing), 99

Cancel All Button Click Event Handler (code listing), 71

Cancel method (SqlCommand), 160

CancelCommand event handler, 576

candidate keys, 785

caption properties

DataGrid's Caption Properties (code listing), 321

setting, 320–321

CaseSensitive property, 122

ChangeDatabase method, 149–150

CHECK constraints, defined, 346

Check In/Check Out component (Video Store Application), 663–665

child table, 99

ChildNodes property, 252

ChildRelations property (DataTable), 99–101

class hierarchy, ADO.NET, 76–80

Class-Level DataTable and DataSet Variables (code listing), 107

Class Wizard, 520

classes and namespaces overview, 13–14

Clear method, 125

clearing DataSets, 125

Client Event Handler for Executing Web Service (code listing), 533

cloning DataSets, 125

Close method (XMLWriter), 250

closing document (XML), 245–246

clustered indexes, 756–757

Code-Behind File of TestDataGrid Program (code listing), 676–677

Code-Behind Object of FancyBinding Page (code listing), 682–684

Code-Behind Object of LazyLoading Page (code listing), 697–700

code listings (by chapter)

ADO.NET basics

ADO.NET application, 27

Viewing Data from SQL Server Database, 30–31

ADO.NET events, handling, 222–223

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

ADO.NET in connected environments

AcceptChanges and RejectChanges methods of a DataSet, Using, 191–192

Adding, Editing, Deleting DataSet Rows, 190–191

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

DataTableMapping to Map Orders Table of Northwind, 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

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 the Update Method of a 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

Table, Adding Records to Using INSERT SQL Statement, 159

TableDirect to Read Table, 158

ADO.NET in disconnected environments, 116

Adding, Updating, and Deleting Rows of DataView, 130

AddRowBtn_Click Method, 109–110

Class-Level DataTable and DataSet Variables, 107

Column, Removing From a Collection, 117

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 of, 89–90

DataRelation, Creating Customer/Order Relationship Using, 100

DataRow's RejectChanges and Delete Methods, Calling, 98

DataSet Custom Properties, Setting and Reading, 123

DataTable Objects, Adding to a DataSet, 124–125

DataView Objects, Creating From a DataTable, 129

DeleteRowsBtn_ClickMethod, 110–112

Form's Constructor Calling CreateCustomersTable, CreateOrdersTable, and BindData, 101

ID, Address, and Name Columns of DataRow, Setting Values of, 95

ID and Name Data Columns of Customers Table, creating, 90

Merging DataRow and DataTable Objects, 127

Merging Two DataSets, 126–127

Ordinal and MaxLength properties, Using, 94

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

RowState property, Calling, 99

Saving DataTable in XML Documents, 114

SearchButtonClick Method, 112–113

Sorting Data Using Select Method, 113–114

State of a Row, Determining, 118

Table, Creating Using DataTable and DataColumn, 91–92

ASP.NET for database Web applications

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 DataSet 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

ASP.NET server controls and data binding

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'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, Settings, 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

Sorting in a DataGrid Control, 606–607

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

COM (Component Object Model) interoperability

ADODB Namespace to Access a Database, 715–716

ADOX from Managed Code, Using, 717–718

Getting All Dimensions of a Cube, 722–723

Getting Cubes from FoodMart 2000 Database, 721–722

Getting Dimension Members, 723–724


Adding and Removing, 350–351

FOREIGN KEY Constraint, Creating, 347–348

PRIMARY KEY Constraint, Adding to DataTable, 352

Reading All Constraints of a Collection, 352

UNIQUE constraint, Creating, 348–349

UNIQUE Constraints, Adding, 351

data binding and data-bound controls

AllowNavigation in Action, 319

Binding Multiple Controls Using Binding, 289

Binding TextBox Using Binding, 288–289

Counting and Removing Binding objects, 290

CreateDataSet Method, 322–323

Custom Recordset, Creating, 337

CustRecordSet.vb, 335–336

DataGridBoolColumn class, Creating, 318

DataGrid's Caption Properties, 321

DataGrid's Color and Font Properties, Using, 320

DataGridTableStyle, Creating and Adding, 315

DataGridTableStyle from CurrencyManager, 316

DataSource and DataMember Properties of a DataGrid Control, Setting, 307

Exchanging the Button Click Handler, 329

FillDataGrid and Form_Load Methods, 328

FillDataGrid Method, 323–324, 341

FillDataSet Method, 305

Form Load Event Handler, 304

Format and Parse Event Handlers, Adding, 292

Form's Load Method, 321

Getting a DataGrid Column Header Name, 332

Getting a DataGrid Columns' Style Using DataGridColumnStyle, 330–331

Getting Current DataGridColumnStyle, 333–334

HitTest in Action, 325–326

ListBox and ComboBox Controls, Binding, 305–306

ListBox Control Event Handler, Adding, 302–303

LoadData and GetDataSet Methods, 298–299

Move Next, Move Previous, Move First, Move Last Button Code, 299

Moving Record Button Click Event Handlers, 337–338

Raising ListBox Events, 303

Reading all Bindings of a Form, 290–291

Reading All Controls Participating in Data Binding, 294

Reading TextBox Control's Binding Properties, 291–292

Record Navigation System Variables, 298

ReshuffleColumns Method, 329–330

Saving Updated Data in a Data Source From a DataGrid Control, 343–344

Search Button Click Event Handler, 341–342

Sorting a DataGrid Control's Columns, 334

data providers, developing custom

Implementation For an Enumerator, 442

PipedDataAdapter Object, 460–462

PipedDataCommand Object, 450–453

PipedDataConnection Object, 447–449

PipedDataProvider Test Case, 463

PipedDataReader Object, 454–459

data relations

Creating a DataRelation, 355

Deleting a Data Relation from the Collection, 358

Filling a DataSet from Two Tables, 354

Getting DataRelation Properties, 356–357

exception handling in ADO.NET

Custom Filter and Error Message, Defining, 364–365

Nested Try...Catch and Multiple Catch Blocks, 363–364

Opening a File, 360

Reading Data from SQL Server, 371–373

Simple Exception Handling Block, 361

Simple Try...Catch Block, 362

SqlError and SqlErrorCollection objects, 373–374

Try...Catch...Finally statement, 362

Frequently Asked Questions, ADO.NET

Binary Data, Reading, 837–838

Browse Button Click Event Handler, 835

DiffGram Format, 840–841

DiffGrams, Reading, 841–842

GetPageData Method, 816

Getting a Database Table Schema Using SqlCommand, 811–812

Getting a Database's Table Schema, 826–827

Getting Database's Tables from SQL Server Database, 825–826

Paging, Implementing in ADO.NET, 817–820

Reading a Database Schema Programmatically, 825

Reading and Writing to and from Windows Registry, 831

Reading DataSet Columns and Their Data Types, 814–815

Reading ODBC DSNs, 832–833

Reading Only Modified Rows of DataSet, 843

Save Image Button Click Event Handler, 835–837

Selecting Distinct Rows from DataBase Table, 827–828

Transactions in OleDb Data Provider, 821

mapped objects

Adding Videos() Array to VideoCategory Object, 695–696

Code-Behind File of TestDataGrid Program, 676–677

Code-Behind Object of FancyBinding Page, 682–684

Code-Behind Object of LazyLoading Page, 697–700

GetBlockedCategory Stored Procedure, 692–693

HTML of FancyBinding Page, 681–682

HTML of TestGridObjects Page, 679–680

HTML Page of Lazy Loading Page, 696–697

HTML Side of TestDataGrid Page, 677–678

Incremental Lazy Loading Stored Procedure, 701

Theoretical Shopping Cart Example, 680–681

VideoCategory and Related Objects, 686–691

VideoCategoryIndexer, 701–703

VideoCategoryIndexer Test Case, 703–704

WeakCache Object, 707–708


Creating a Queue, 737

Deleting a Queue, 738

Encrypted Messages, Sending, 751

Filtering Queues Based on

Category, Machine Name, and Label, 733–734

Getting a Queue's Properties, 738

Private Queues, Retrieving, 732

Public Queues, Retrieving, 732–733

Receiving Messages from a Queue, 743–744

Sending Messages to a Queue, 743

Transactional Messages, Sending and Receiving, 749–750

object-relational (OR) mapping in .NET

SelectVideosCheckedOutToUser, 665

User Object in the User Component, 655–656

UserData Object in the User Component, 656–657

UserDataAccess Object in the User Component, 657–659

UserTestCase Object, 660–661

VideoCheckInCheckOut Component, Test Case for, 671–673

VideoCheckInCheckOut Object, 667–670

VideoTape Component, Test Case For, 653–654

VideoTape Object, 645–648

VideoTapeData Object, 643–644

VideoTapeDataAccess Object, 648–652

ODBC .NET data provider

Employees.xls, Accessing Using ODBC Data Provider, 390

MySQL Database, Accessing, 382

Reading Data from Northwind Using ODBC Data Provider, 379–380

TextDB.txt file, Accessing, 388

Oracle .NET data provider

Connecting to an Oracle Database, 417–418

Constructing SQL INSERT, UPDATE, DELETE Queries, 421

ExecuteSqlQuery Method, 420

FillDataGrid Method, 419–420

Oracle-Specific DataReader Methods, 423

OracleDataAdapter, Reading/Writing Data Using, 423–424

OracleDataReader, Reading Data Using, 422–423

SQL Server and ADO.NET

Generic Data Access Class, 771–773

Generic Data Access Class, Using, 774–775

Query from SelectVideosCheckedIn, Not Optimized, 762–763

SelectVideosCheckedIn Query, Optimized Version, 763–764

sp_executesql to Execute a Database Query, 765

User-Defined Variables, 773–774

SQLXML and SQL XML .NET data providers

SqlXmlAdapter, Using, 429

SqlXmlCommand to Execute Commands, 433–435

stored procedures and views

AddCat1 Stored Procedure, 404

Executing mySP Stored Procedure Using SQL Data Provider, 400–401

Executing Stored Procedure with Output Parameter, 404–405

Executing Views Programmatically, 410

Parameters, Using in Stored Procedure, 402–404

Visual Studio .NET data components

Added Sql Server Provider Components, 48–49

Calling DataForm1 from Button Click, 65

Calling DataForm2 from Button Click, 66

Cancel All Button Click Event Handler, 71

DataAdapter Connection through TableMapping, 49

FillDataSet Method Generated by Data Form Wizard, 69

Form's Load Event Handler, 50–51

Load and Update Button Click Event Handlers, 67–68

LoadDataSet Method Generated by Data Form Wizard, 68–69

UpdateDataSource and UpdateDataSet Methods Generated by Data Form Wizard, 70–71

Web applications, building Button Click Event Handlers, 614–615

DisplayData.aspx HTML View, 624–627

Done Button Click Event Handler, 620, 623

FillDataGrid and Page_Load Methods, 627, 629

FillPartialData Method, 628

Login Button Click Event Handler Code, 613

Post Job Button Click Event Handler, 619

Post Resume Button Click Event Handler, 622–623

Post Resume Page, Adding Options to, 621–622

Register.aspx Code, 616

Resumes.aspx HTML View, 630–632

Send Message Click Event Handler, 618

XML integration with ADO.NET

Adding a Node with Attributes, 260

Adding Nodes to a Document, 256

Appending in an XML Document Fragment, 254

GetAttribute of a Node, Using, 243–244

Getting Node Information, 240–241

Getting Root Node of Document, 256

Getting XML Node Information, 240

Inserting XML Fragment into Document, 259

MoveToContent Method, Using, 243

Moving to Root and First Child Nodes Using XPathNavigator, 274–275

Output of XmlWriterSample.vb Class, 249–250

Reading an XML file, 239

RemoveAll for books.xml, Calling, 258

Removing All Items of a Node, 257

ReplaceChild, Calling, 258

Saving DataSet Data to XML Document, 271–272

Skip Method, Using, 244

WriteXml method Output, 266

WriteXml method, Using, 265–266

WriteXmlSchema Method, Using, 267

XML Schema Generated for Database Table, 284–285

XmlConvert Class, Using, 251

XmlDataDocumentSample.vb, 270

XmlDocumentFragment Sample, 254

XmlWriter Example, 248–249

XPathIterator and Select, Using, 276–277

XPathNavigator, Reading Document Using, 275–276

XSL Transformation, 262

XML Web services

Button-Click Event Handler for Calling Order Retrieval Web Service, 528–529

Client Event Handler for Executing Web Service, 533

ExecuteQuery Method, 534

GetOrdersFromDatabase Method, 521

Populating an Order in Database, Web Service Method for, 530–531

WebService and WebMethod Attributes, Adding Descriptions to, 522–524

Color and Font Properties, Using DataGrid's (code listing), 320


column and table mapping, 178–181

ColumnChanged event, 222–223

ColumnChanging and ColumnChanged Event Handlers, Writing (code listing), 222–223

ColumnMapping property, 92

ColumnMapping Property of DataColumn, Using (code listing), 92

Columns property page, 494–495

Creating Using Different DataColumn Constructors (code listing), 88–89

customizing and rearranging, 587–589

defined, 779

determinant, 785

header names, getting, 332

mappings, 45

selecting for indexing, 757–758

understanding, 586–587

COM (Component Object Model)

marshaling, 12–13

Web services and, 517

COM interoperability, 709–724

.NET Framework interop tools, 710–712

Type Library Exporter (Tlbexp.exe), 712

Type Library Importer (Tlbimp.exe), 711

Visual Studio .NET, 710

ADO recordset and ADO.NET, 712–716

ADOX, using with ADO.NET, 716–718

basics, 709–710

code listings

ADODB Namespace to Access a Database, 715–716

ADOX from Managed Code, Using, 717–718

Getting All Dimensions of a Cube, 722–723

Getting Cubes from FoodMart 2000 Database, 721–722

Getting Dimension Members, 723–724

COM and .NET Interoperability, 709

OLAP server data, accessing, 718–724

ComboBox and ListBox controls, data binding in, 304–306

Comma Separated Values (CSV) format, 438

Command Behaviors, 165–166

Command components, 75

Command objects

basics, 17–18

creating, 25

in custom data provider interfaces, 440–441

vs. DataSet for updating data sources, 776

properties, 150

SQL statements, executing, 150–160

calling stored procedures, 155–157

Command methods, 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


enumeration, 843–844

understanding, 165–166

CommandBuilder object

creating, 182

defined, 19

SqlCommandBuilder members, 182

SqlCommandBuilder, using, 182–184

CommandType enumeration, 154–155

Commit, Rollback, and Savepoints, 204–206

committed transactions, 747

complex and simple data binding, 288, 538

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

component isolation, 666–670

components of ADO.NET, 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


concurrency control, 199

transactions and, 198–200

using, 201–204

conditional statements in SQL, 799

Configure Data Adapter property, 46–47

connected environments, ADO.NET in.

See ADO.NET in connected


connecting to data sources. See data sources, connecting to

Connecting to SQL Server and Reading SqlConnection Properties (code listing), 144–145

Connecting to SQL Server Using OleDb Data Provider (code listing), 144

Connection class members, 141

Connection component of DataProvider, 136

Connection events, 211–215

Connection Events, Writing Code That Executes (code listing), 214–215

Connection objects

in custom data provider interfaces, 439–440

definition and fundamentals, 16–17

properties, 140

connection pooling, 145–149

connection strings

for different data providers, 845

Oracle .NET data provider, 417

pooling and, 777

SqlXmlAdapter object, 428

understanding, 40


closing, 26, 142–145

Connections, Creating Two with Different Strings (code listing), 147–148

ConnectionState enumeration members, 213

ConnectionString property, 142

ConnectionType enumeration members, 141

creating, 139–140

creating in Oracle .NET data provider, 416–418

data, 38–40

disconnected data and, 11–12

establishing, 24–25

opening and closing, 142–145

properties and methods, 140–141


adding and removing, 350–351

code listings

Adding PRIMARY KEY Constraint to DataTable, 352

Constraints, Adding and Removing, 350–351

FOREIGN KEY Constraint, Creating, 347–348

Reading All Constraints of a Collection, 352

UNIQUE Constraint, Creating, 348–349

UNIQUE Constraints, Adding, 351

Constraint classes, implementing, 346

constraint rule, 85

ConstraintCollection class, 349–350

ForeignKeyConstraint class, implementing, 346–348

PRIMARY KEY constraints, adding, 352

property, 101

reading all constraints, 352

SQL statements to add and remove, 352–353

types of, 345–346

UniqueConstraint class, 348–349

Contact.aspx page (Online Job Board Application), 617–618

Contains, Find, and Remove Method of DataRowCollection, Using (code listing), 116

content node, moving to (XML), 242–243

Control and Page classes in data binding, 301, 539

Count (*) to determine number of rows, 823

Counting and Removing Binding Objects (code listing), 290


CREATE TABLE SQL statement, 353

CREATE TABLE statements, 803

CREATE VIEW SQL statements, 808–809

CreateCommand and ChangeDatabase methods, 149–150

CreateCustomersTable Method (code listing), 107–109

CreateDataSet Method (code listing), 322–323

Creating a Queue (code listing), 737

Creating DataView Objects From a DataTable (code listing), 129


Getting All Dimensions of (code listing), 722–723

Getting from FoodMart 2000 Database (code listing), 721–722

CultureInfo object, 123


DataGridTableStyle From (code listing), 316

and PropertyManager, 295–296

for synchronization of controls, 293


locks and, 766

and recordsets, 786–787

CustEmpView, 409–410

custom controls (server-side), 483

custom data providers, developing. See data providers, developing custom

custom filters and error messages, 364–365

Custom Properties, Adding and Removing (code listing), 93

Custom Properties of a DataSet, Setting and Reading (code listing), 123–124

Custom Recordset, Creating (code listing), 337

Customer/Orders Relationship Example (code listing), 102–105

CustRecordSet.vb (code listing), 335–336

Applied ADO. NET(c) Building Data-Driven Solutions
Applied ADO.NET: Building Data-Driven Solutions
ISBN: 1590590732
EAN: 2147483647
Year: 2006
Pages: 214 © 2008-2017.
If you may any questions please contact us: