Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between DataSource and DataSet

I am currently working on project whose main task is to read data stored in SQL database and to display them in user-friendly form. Programming language used is C++. I am working in Borland C++ Builder 6 environment. But I think question posed in title is independent from programming language or libraries. When reading data from db i am quite frequently meeting with these terms in class names without knowing exactly what they represent. I understand that they behave as interface to data stored in db. But why there is need to use two interface classes instead of one?

like image 730
truthseeker Avatar asked Feb 17 '12 09:02

truthseeker


People also ask

What is difference between dataset and database?

A dataset is a structured collection of data generally associated with a unique body of work. A database is an organized collection of data stored as multiple datasets.

What does datasource mean?

A data source is the location where data that is being used originates from. A data source may be the initial location where data is born or where physical information is first digitized, however even the most refined data may serve as a source, as long as another process accesses and utilizes it.

What is source and data base?

In computer programming, source data or data source is the primary location from where data comes. The data source is a database, a dataset, a spreadsheet or even hard-coded data. When data is displayed, it is retrieved from its data source.

What is a data source example?

Various databases are examples of data sources. Consider a shoe brand that sells things online. The website uses data from a stock database to determine if a product is out of stock. The stock records are a data source in this scenario, which is retrieved by the web program that provides the website to consumers.


2 Answers

DataSource = How you connect to your database DataSet = Structure of your database in memory

More in details (from the Exam 70-516: TS: Accessing Data with Microsoft .NET Framework 4 book):

DataSource This is the primary property to which you assign your data. You can assign anything that implements the IList, IListSource, IBindingList, or IBindingListView interface. Some examples of items that can be assigned to the DataSource property are arrays (IList), lists (IList), data tables (IListSource), and data sets (IListSource).

DataSet is a memory-based, tabular, relational representation of data and is the primary disconnected data object. Conceptually, think of DataSet as an in-memory relational database, but it’s simply cached data and doesn’t provide any of the transactional properties (atomicity, consistency, isolation, durability) that are essential to today’s relational databases. DataSet contains a collection of DataTable and DataRelation objects

like image 142
Diego Avatar answered Sep 22 '22 10:09

Diego


Assuming you are talking about the .NET ecosystem, these two terms mean very different things.

A DataSet is a class representing relational data in the process memory (that is, outside the database) - normally populated from a database. It represents tables and relationships between them (say foreign key constraints).

DataSource is an attribute in data binding - assigning an object to a control on the DataSource property binds a source of data (such as a DataSet) to a control.

like image 44
Oded Avatar answered Sep 22 '22 10:09

Oded