-1

I know the DataAdapter works as an interface between data source and dataset but I can't understand the role of dataset in the DataAdapter command types such as UpdateCommand, DeleteCommand, etc?

Any idea to help understand the relation between DataAdapter and Dataset or what is the role of dataset in the fallowing example?

This is an examples:

UpdateCommand

Adapter Commands

Question
  • 61
  • 11

1 Answers1

1

DataAdapter are indeed work as an interface between data source and the data set as you have denoted. There are several options you can perform on a data source. These SCRUD (Search, Create, Retrieve, Update, Delete) functions are performed through SQL statements. As you are going to preforms these operations on data through the DataAdapter you should specify the way to performs these tasks, because all of the depend on the structure of the data source you are trying to access.

Spesifically talking about the example, it defines the SQL commands. Search command works via country and city, when you need to create a new Customer record, you have to provide CustomerId and Company name etc.

You define those commands once, and then use the same command for all operations on the same data source. This answer also gives a spesfici example on how to use DataAdapter's Update command.

Community
  • 1
  • 1
user3021830
  • 2,784
  • 2
  • 22
  • 43
  • Thanks a lot but where is the concept of dataset in my example? how this concept used for dataAdapter in the example? I wish the question become more clear now. – Question Feb 22 '15 at 16:59
  • Unfortunately your example jusy focuses on the creational phase of the solution. But in the example I have referenced thre is an answer which includes the use of DataSet:. Hope it helps. Otherwise I will be glad to help more if I can. – user3021830 Feb 22 '15 at 17:01
  • yes your example is clear but I understand this case. The problem is the function or the role of dataset in my example. Thanks. – Question Feb 22 '15 at 17:05
  • Oh sorry, my mistake. The spesific purpose of ther DataSet here is to hold the operationsl value(s). For example while selecting you get the return values via DataSet. And while creating a new record(s), you don't have to go to the database for each record, instead you insert them as a new record to your dataset. At the end you send the DataSet to the database to do all necessary operations. So you can update, insert, delete several records at one. It manages all operations via pre-defined queries. – user3021830 Feb 22 '15 at 17:10