Category Archive for: Data Access

Working with ADO.NET

This section addresses some common scenarios when developing data access applications with ADO.NET. Tiered Development Producing an application that interacts with data is often done by splitting up the application into tiers. A common model is to have an application tier (the front end), a data services tier, and the database itself. One of the difficulties with…

Read More →

Persisting DataSet Changes

After editing data within a DataSet, it is usually necessary to persist these changes, The most common example is selecting data from a database, displaying it to the user, and returning those updates to the database. In a less “connected” application, changes might be persisted to an XMl riic, transported to a middle-tier application server, and then processed…

Read More →

Populating a DataSet

After you have defined the schema of your data set, replete with DataTable, DataColumn, and Constraint classes, and whatever else is necessary, you need to be able to populate the dataSet class With some Information, You have two main ways to read data from an external source and insert it inito the DataSet class: ¤ Use a data…

Read More →

XML Schemas: Generating Code with XSD

XML is firmly entrenched in ADO.NET – indeed, the remoting format for passing data between objects is now XML With the .NET runtime, it is possible to describe a DataTabl e class within an XML schema definition file (XSD), What’s more, you can define an entire DataSet class, with a number of DataTable classes, and a set of…

Read More →

Managing Data and Relationships: The DataSet Class

The DataSet has been designed as an offline container of data. It has no notion of database connections, In fact, the data held within a DataSet does not necessarily need to have come from a database – it could just as easily be records from a CSV file, or points read from a measuring device. ADataSet class…

Read More →

Fast Data Access: The Data Reader

A data reader is the simplest and fastest way of selecting some data from a data source, but it is also the least capable, You cannot directly instantiate a data reader object – an instance is returned from the appropriate database’s command object (such as SqlCommand) after having called the ExecuteReader () method. The following code demonstrates how…

Read More →

Commands

The Using Database Connections” section briefly touched on the idea of issuing commands against a database, A command is in its simplest form, a string of text containing SQLstatements that is to be issued to the database, A command could also be a stored procedure, or the name of a table that will return all columns and all…

Read More →

Using Database Connections

To access the database, you need to provide connection parameters, such as the machine that the database is running on and possibly your login credentials, Anyone who has worked with ADO will be familiar with the .NET connection classes: 01 DbConnect ion and Sql Connection, Figure 26-1 shows two of the connection classes and includes the class…

Read More →

ADO.NET Overview

ADO.NET is more than just a thin veneer over some existing API. The similarity to ADO is fairly minimal- the classes and methods of accessing data are completely different. ADO (ActiveX Data Objects) is a library of COM components that has had many incarnations over the past few years. Currently at version 2.8,ADO consists primarily of the Connection,…

Read More →

Data Access

This chapter discusses how to access data from your C# programs using ADO.NET.The following details are covered: ¤ Connecting to the database – You learn how to use the SqlConnection and OleDbConnection classes to connect to and disconnect from the database. ¤ Executing commands – ADO.NET has command objects that can execute SQL commands or issue a call to a…

Read More →

Back to Top