Solved

DataAdapter VS Command

Posted on 2004-04-29
2
875 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
ID: 10951249
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
ID: 10951293
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

27 Experts available now in Live!

Get 1:1 Help Now