Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
ASP .NET Database Programming Weekend Crash Course - J. Butler, T. Caudill.pdf
Скачиваний:
32
Добавлен:
24.05.2014
Размер:
3.32 Mб
Скачать

204

Saturday Evening

Suppose that oDS is a DataSet object. In order to retrieve the name of a DataSet, you may use:

Dim sName As String sName = oDS.DataSetName

CaseSensitive property

The CaseSensitive property gets or sets a value (as a Boolean) indicating whether string comparisons within DataTable objects are case sensitive. The CaseSenstive property affects operations such as sorting, filtering, and searching a DataTable. The default value for this property is False. If you want to set the property to True, use the following syntax:

oDS.CaseSensitive = True

By default, setting the CaseSensitive property for a DataSet also sets each of its DataTable object’s CaseSensitive property to the same value. However, the DataSet’s CaseSensitive property can be overridden by a DataTable’s CaseSenstive property. In order to retrieve the CaseSensitive property you may use the following code:

Dim bCase As Boolean bCase = oDS.CaseSensitive

REVIEW

The ADO.NET DataSet object, is a very complex, yet exciting object. The DataSet is a mem- ory-resident database that provides a consistent programming model regardless of its data source. The DataSet is designed to work in a disconnected environment, so passing a DataSet from one system to another is expected. In order to create a DataSet, you can use a

DataAdapter, OleDbDataAdapter, or SqlDataAdapter object.

QUIZ YOURSELF

1.What are some of the differences between the Command and DataAdapter objects? (See session introduction.)

2.What is a DataSet and how does it differ from a DataReader? (See session introduction.)

3.How is the DataAdapter method used to populate a DataSet? (See “Fill method.”)

P A R T

IV

Saturday Evening

Part Review

The following set of questions is designed to provide you with feedback on how well you understood the topics covered during this part of the book. Please refer to Appendix A for the answers to each question.

1.Which namespace can be used to access the OleDbConnection objects?

a.System.Web

b.System.Data.Connections

c.System.Data.ADO

d.System.Data.OleDb

2.Which namespace can be use to manipulate XML data?

a.System.XML

b.System.Data.Connections

c.System.Data.ADO

d.System.Data.OleDb

3.OleDbConnection and SqlConnection objects must be created explicitly. True/False

206

Part IV—Saturday Evening Part Review

4.Which of the following OleDbConnection properties is used to obtain the database to which an OleDbConnection object is connected?

a.Provider

b.DataSource

c.Database

d.UserID

5.A Command object is basically a facility for executing commands against a datasource.

True/False

6.In order to create an OleDbCommand object, an OleDbConnection object must be specified in its constructor.

True/False

7.Which OleDbCommand class property is used to specify the SQL command or stored procedure to execute?

a.ActiveConnection

b.Command

c.CommandText

d.ExecuteString

8.Fill in the blank: The SqlCommand class’s ______ property gets or sets how the CommandText is interpreted

9.A DataReader object is a forward-only collection of records from a data source.

True/False

10.Fill in the blank: The OleDbDataReader object is created via the ______

object’s Execute method.

11.A SqlDataReader object has a constructor. True/False

12.The OleDbDataReader allows forward and backward row navigation. True/False

13.A DataSet can contain multiple tables, but not the relationships between the tables.

True/False

Part IV—Saturday Evening Part Review

207

14.The DataAdapter objects provide a bridge to retrieve and update data between a DataSet and a data store.

True/False

15.Fill in the blank: The OleDbDataAdapter’s ______ property gets or sets a Command object used to select records in a DataSet.

16.Fill in the blank: The SqlDataAdapter’s ______ method adds data from a datasource to a DataSet.

Part V — Sunday Morning

Session 21

Introducing Datasets, Part II

Session 22

Introducing Data Binding

Session 23

Using the DataGrid Control with Bound Data

Session 24

Beating the CRUD out of the DataGrid Control

Session 25

Data Shaping with ADO.NET

Session 26

Handling ADO.NET Errors

Part VI — Sunday Afternoon

Session 27

SOAP It Up!

Session 28

Web Services

Session 29

Migrating from ASP to ASP.NET

Session 30

Migrating from ADO to ADO.NET

P A R T

V

Sunday

Morning

Session 21

Introducing Datasets, Part II

Session 22

Introducing Data Binding

Session 23

Using the DataGrid Control with Bound Data

Session 24

Beating the CRUD out of the DataGrid Control

Session 25

Data Shaping with ADO.NET

Session 26

Handling ADO.NET Errors