Solved

DataAdapter VS Command

Posted on 2004-04-29
2
865 Views
Last Modified: 2008-10-09
Hello,
      I am going to ask a question which looks illogical to me but I have to ask.

As you all people know that in .NET Microsoft has introduced a new concept of ADO with two new things DataAdapter and DataSet. And they called it disconnected approach.
And we have still got the other method or you can say old method which is direct access to database with command.

The point which disturbs me a lot is that should we always use DataAdapter and dataset or there are few situations when we can use it.

For example in the case of user login form which technique I need to use. DataApter or Command

Please clear my concept

With best regards fazi
0
Comment
Question by:mfazi
  • 2
2 Comments
 
LVL 21

Accepted Solution

by:
tovvenki earned 75 total points
Comment Utility
Hi,

The advantages of the dataset model are:
·      Working with multiple tables   A dataset can contain multiple tables of results, which it maintains as discrete objects. We can work with the tables individually or navigate between them as parent-child tables.
·      Manipulating data from multiple sources   The tables in a dataset can represent data from many different sources (for example, from different databases, from XML files, spreadsheets, and so on, all in the same dataset). Once the data is in the dataset, we can manipulate it and relate it in a homogeneous format as if it had come from a single source.
·      Moving data between tiers in a distributed application   By keeping data in a dataset, we can easily move it between the presentation tier, business tier, and data tier of our applications.
·      Data exchange with other applications   A dataset provides a powerful way to exchange with other components of our application and with other applications. Datasets include extensive support for features such as serializing data as XML and reading and writing XML Schemas.
·      Data binding   If we are working with forms, it is usually easier to bind controls to data in a dataset than it is to programmatically load data values into the control after executing a command.
·      Maintaining records for reuse   A dataset allows us to work with the same records repeatedly without requerying the database. Using dataset facilities, we can filter and sort records, and we can use the dataset as a source of data if we are paging.
·      Ease of programming   When we work with a dataset, we can generate a class file that represents its structure as objects (for example, a Customers table in the dataset can be accessed as the dataset.Customers object). This makes it easier, clearer, and less error-prone to program with, and is supported by Visual Studio tools such as IntelliSense, the Data Adapter Configuration wizard, and so on.

The advantage of performing database operations directly using datacommands is:
·      Extra functionality   there are some operations, such as executing DDL commands, that we can only accomplish by executing data commands.
·      More control over execution   By using commands (and a data reader, if we are reading data), we get more direct control over how and when an SQL statement or stored procedure is executed and what becomes of the results or return values.
·      Less overhead   By reading and writing directly to the database, we can bypass storing data in a dataset. Because the dataset requires memory, we can reduce some overhead in our application. This is especially true in situations where we intend to use the data only once, such as displaying search results in a Web page. In that case, creating and filling a dataset might be an unnecessary step in displaying the data.
·      Less programming in some instances   In a few instances, particularly Web applications, there is some extra programming required to save the state of a dataset. For example, in Web Forms pages, the page is recreated with each round trip; unless we add programming to save and restore a dataset, it, too, is discarded and recreated with each round trip. If we use a data reader to read directly from the database, we can avoid the extra steps required to manage the dataset.
Because of the stateless nature of Web applications and the corresponding issues associated with storing datasets, it is sometimes more practical in Web applications to work directly against the database.

I hope that this helps you.
regards,
venki
0
 
LVL 21

Expert Comment

by:tovvenki
Comment Utility
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now