Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional, Second Edition
by Matthew MacDonald
15.6. Disconnected Data Access
When you use disconnected data access, you keep a copy of your data in memory using the DataSet. You connect to the database just long enough to fetch your data and dump it into the DataSet, and then you disconnect immediately.
There are a variety of good reasons to use the DataSet to hold onto data in memory. Here are a few:
You need to do something time-consuming with the data. By dumping it into a DataSet first, you ensure that the database connection is kept open for as little time as possible.
You want to use ASP.NET data binding to fill a web control (like a grid) with your data. Although you can use the DataReader, it won't work in all scenarios. The DataSet approach is more straightforward.
You want to navigate ...
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