Working with Data Tables in the XML Designer

In the previous section, we examined the structure of tags within a DataSet schema. Remember that we said that DataTables are defined as elements within a choice group. The DataTable itself has the following nominal structure < xs element name myTable> < xs element name Column1 type xs string > < xs element name Column2 type xs Boolean > The structure is similar to the nominal structure of a schema an element is created and assigned the name of the table. Within the element is an...

Data Binding in Web Forms

In this chapter, you'll learn how to Simple-bind controls at design time Simple-bind controls at run time Display bound data on a page Complex-bind controls at design time Complex-bind controls at run time Store a DataSet in the session state Store a DataSet in the ViewState Update a data source using a Command object In the previous eleven chapters, we've examined the ADO.NET object model, using examples in Windows forms. In this chapter, we'll examine the way that Microsoft ADO.NET interacts...

Creating XML Schema and Typed Data Sets

Like HTML and other markup languages descended from SGML, XML schema files are created using tags that are delimited by angle brackets XML schema files begin with a tag that identifies the version of XML that is being used. .NET Framework XML schema files follow this with an < xs schema> tag whose targetNamespace attribute defines the namespace of all the components in this schema and any included schemas. The < xs schema> tag also includes references to two namespaces the W3C XML...

Visual Basic NET

In the form designer, select the epDataSet ErrorProvider control. 2. In the Properties window, select the DataSource property, expand the drop-down list, and then select dsMaster1. 3. Select the DataMember property, expand the drop-down list, and then 4. Double-click the btnDataSet button. Visual Studio adds the event handler template to the code editor. 5. Add the following code to the event handler 6. This code artificially creates an error condition for the Description column of the second...

Complex Binding Control Properties

Unlike simple-bound properties, which must be bound to a single value, complex-bound control properties contain and possibly display multiple items. The most common examples of complex-bound controls are, of course, the ListBox and ComboBox, but any control property that accepts multiple values can be complex-bound. Although the techniques can vary somewhat depending on the specific control, most complex-bound controls are bound by setting the DataSource property directly rather than by adding...

Using Adonet in Web Forms

In this chapter, you'll learn how to Display data in a DataGrid control Implement sorting in a DataGrid control Display data in a DataList control Display a DataList control as flowed text Implement paging in a DataGrid control Implement manual navigation in a Web form Use validation controls to control user entry In the previous chapter, we examined the basic data-binding architecture for Web forms. In this chapter, we'll examine a few common data-binding tasks in more detail. Microsoft...

Moving Through Data

Whenever performance and scalability are issues, it's important to limit the amount of data displayed on a single page. For usability reasons, you should always limit the amount of data that is displayed, no matter what the environment users don't appreciate having to wade through masses of data to find the single bit of information they require. One common technique in the Internet environment for limiting the amount of data on a single Web page is to display only a fixed number of rows and...

Visual C NET

In the form designer, double-click Read Data. Visual Studio adds the event handler to the code. 2. Add the following code to the event handler 3. System.Data.DataSet newDS new System.Data.DataSet XmlReadMode.ReadSchema SetBindings newDS The data.xml file contains an inline schema definition, so by passing the ReadSchema XmlReadMode parameter to the ReadXml method, the code instructs the DataSet to first create the DataSet schema and then load the data. 7. Press F5 to run the application. The...

OnRow Updated Event

The OnRowUpdated event is raised after the Update method executes the appropriate command against the data source. The event handler for this event is either passed an SqlRowUpdatedEventArgs or an OleDbRowUpdatedEventArgs argument, depending on the Data Provider. Either way, the event argument contains all of the same properties as the RowUpdatingEvent argument, plus an additional property, a read-only RecordsEffected argument that indicates the number of rows that were changed, inserted, or...

Data Column Expressions

Expressions, technically DataColumn Expressions, are used by the RowFilter and Sort properties of the DataView. We've used DataColumn Expressions in previous chapters when we created a calculated column in a DataTable and when we set the sort and filter expressions for the DataTable Select method. Now it's time to examine them more closely. A DataColumn Expression is a string, and you can use all the normal string handling functions to build one. For example, you can use the amp concatena-tion...

Using the Binding Context Object

As we have seen, the BindingContext object is the highest level object in the binding hierarchy and manages the BindingManagerBase objects that control the interaction between a data source and the controls bound to it. The BindingContext object doesn't expose any useful methods or events, and has only a single property, as shown in Table 10-1. The Item property is used to index into the BindingManagerBase collection contained in the BindingContext object. The first version, which uses only the...

Command Methods

The methods exposed by the Command object are shown in Table 3-6. Of these, the most important are the four Execute methods ExecuteNonQuery, ExecuteReader, ExecuteScalar, and ExecuteXmlReader. ExecuteNonQuery is used when the SQL command or stored procedure to be executed returns no rows. An Update query, for example, would use the ExecuteNonQuery method. ExecuteScalar is used for SQL commands and stored procedures that return a single value. The most common example of this sort of command is...

Microsoft Adonet Step by Step

Riordan All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Library of Congress Cataloging-in-Publication Data Riordan, Rebecca. Microsoft ADO.NET Step by Step Rebecca M. Riordan. p. cm. Includes index. ISBN 0-7356-1236-6 1. Database design. 2. Object oriented programming Computer science 3. ActiveX. I. Title. QA76.9.D26 R56 2002 005.75'85 dc21...