Chapter 6. Copying and Transferring Data
6.0. Introduction
This chapter focuses on copying data between ADO.NET classes and between ADO and ADO.NET classes, serializing and deserializing data, and encrypting data and login credentials to build secure applications.
Copying rows from one DataTable to another and copying tables from one DataSet to another are operations performed frequently in data-centric applications. Recipes Recipe 6.1 and Recipe 6.2 show different ways to copy data and discuss the advantages, limitations, and disadvantages of the different approaches.
The DataReader provides connected forward-only, read-only access to a data stream, while the DataSet provides disconnected access to data stored as an in-memory relational database. Recipes Recipe 6.3, Recipe 6.4, Recipe 6.5, and Recipe 6.6 show how it's done.
In addition, this chapter covers:
- Serializing and deserializing data
Serialization allows data conversion to a format that can be persisted or transported. The .NET framework supports serialization and deserialization with the
System.Runtime.Serializationnamespace. Support for binary, XML, and SOAP formats is built in and serialization can easily be customized if required. Recipes Recipe 6.7 and Recipe 6.8 show how to serialize and deserialize data.As well as copying data, ADO.NET supports merging disconnected data in
DataTableorDataSetobjects into each other. Recipe 6.9 shows how merging works and how to use the arguments that control the merge operation.- Security ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access