.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
abhays
satyapriyanayak
SP
Ashutosh Jha
Mahesh

Home >> Interview Question >> C# >> Post New Question Subscribe to Interview Questions

What is the main difference between DataSet.Clone() and DataSet.Copy() ?

Posted By :Srikanth     Posted Date :April 22, 2011    Points :40   Category :C# 
Generally

DataSet.Clone() would copy only the schema of the DataSet object and it would return the DataSet object that has same struture that the previous dataset object which includes all the relations, constraints and schemas as well. This will not copy the data from the existing one to new one.

The existing Dataset ---

private DataSet CreateMyClone(DataSet myCloneDataSet)

{

DataSet exampleCloneDS;

exampleCloneDS = myCloneDataSet.Clone();

return exampleCloneDS;

}




DataSet.Copy() will copy complete code as well as the structure of the existing DataSet object.

You can also find related Interview Question to What is the main difference between DataSet.Clone() and DataSet.Copy() ?  below: 

Difference Between Dataset.Clone() and Dataset.Copy() ?

  
DataSet.Clone()--Reflects Only Schema to The Dataset


DataSet.Copy()--Retrives total Records to Dataset (More...)

What is difference between Dataset.clone and Dataset.copy?

  
Dataset.Clone- It only copies structure, does not copy data.
Dataset.Copy - Copies both structure and data. (More...)

Difference between DataSet Clone and DataSet Copy?

  
DataSet.Clone() - It only copies the structure but doesnot Copies the Data;
Dataset.Copy() - It copies both Structure and data..
(More...)

What is the differences between dataset.clone and dataset.copy?

  
Dataset.clone copies just the structure of dataset (including all the datatables, schemas, relations and constraints.); however it doesn't copy the data.
Dataset.copy, copies both the dataset structure and the data.
(More...)

What is the difference between Data Reader & Dataset?

  
Data Reader is connected datasource, read only, forward only record set.

Dataset is disconnected datatsource resides in memory database that can store multiple tables, relations and constraints; (More...)

Difference between Dataset and Datareader?

  
Data Set is a connectionless service and Data reader is a connection oriented service. Dataset is used to store the data, it contains collections of Datatable. Datareader is used to connect to the database for retrieving data.
Data Reader - Forward only where as Dataset - Can loop through dataset.
Data Reader - Connected Recordset where as DataSet - Disconnected Recordset
Data Reader - Less Memory Occupying where as DataSet - It occupies more memory
Data Reader - Only Single Table can be used where as Dataset - Datatable Concept allows data to be stored in multiple tables.
Data Reader - Read only where as DataSet - Can add/update/delete using the dataset
Data Reader - No relationship can be maintained where as DataSet - Relationship can be maintained.
Data Reader - No Xml Storage available where as DataSet - Can be stored as XML.
The Dataset is a core of disconnected architecture. Disconnected architecture means once you have retrieved the data from the database the data source is dropped. The disconnected data become very commonly. The dataset for the disconnected data from the Dataset object. The DataReader is a readonly, forward only stream from the database. While using the datareader can improve the application performance reduces the system overhead because only one buffer row at a time in memory.


Shashi Ray (More...)

Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?

  
. Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
. A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
. A DataSet is designed to work without any continuing connection to the original data source.
. Data in a DataSet is bulk-loaded, rather than being loaded on demand.
. There's no concept of cursor types in a DataSet.
. DataSets have no current record pointer You can use For Each loops to move through the data.
. You can store many edits in a DataSet, and write them to the original data source in a single operation. (More...)

Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?

  
In ADO, the in-memory representation of data is the recordset. In ADO.NET, it is the dataset. There are important differences between them.
o A recordset looks like a single table. If a recordset is to contain data from multiple database tables, it must use a JOIN query, which assembles the data from the various database tables into a single result table. In contrast, a dataset is a collection of one or more tables. The tables within a dataset are called data tables; specifically, they are DataTable objects. If a dataset contains data from multiple database tables, it will typically contain multiple DataTable objects. That is, each DataTable object typically corresponds to a single database table or view. In this way, a dataset can mimic the structure of the underlying database. A dataset usually also contains relationships. A relationship within a dataset is analogous to a foreign-key relationship in a database -that is, it associates rows of the tables with each other. For example, if a dataset contains a table about investors and another table about each investor's stock purchases, it could also contain a relationship connecting each row of the investor table with the corresponding rows of the purchase table. Because the dataset can hold multiple, separate tables and maintain information about relationships between them, it can hold much richer data structures than a recordset, including self-relating tables and tables with many-to-many relationships.
o In ADO you scan sequentially through the rows of the recordset using the ADO MoveNext method. In ADO.NET, rows are represented as collections, so you can loop through a table as you would through any collection, or access particular rows via ordinal or primary key index. DataRelation objects maintain information about master and detail records and provide a method that allows you to get records related to the one you are working with. For example, starting from the row of the Investor table for "Nate Sun," you can navigate to the set of rows of the Purchase table describing his purchases. A cursor is a database element that controls record navigation, the ability to update data, and the visibility of changes made to the database by other users. ADO.NET does not have an inherent cursor object, but instead includes data classes that provide the functionality of a traditional cursor. For example, the functionality of a forward-only, read-only cursor is available in the ADO.NET DataReader object. For more information about cursor functionality, see Data Access Technologies.
o Minimized Open Connections: In ADO.NET you open connections only long enough to perform a database operation, such as a Select or Update. You can read rows into a dataset and then work with them without staying connected to the data source. In ADO the recordset can provide disconnected access, but ADO is designed primarily for connected access. There is one significant difference between disconnected processing in ADO and ADO.NET. In ADO you communicate with the database by making calls to an OLE DB provider. In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source. The important difference is that in ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the database - by optimizing for performance, performing data validation checks, or adding any other extra processing. Data adapters, data connections, data commands, and data readers are the components that make up a .NET Framework data provider. Microsoft and third-party providers can make available other .NET Framework data providers that can be integrated into Visual Studio.
o Sharing Data Between Applications. Transmitting an ADO.NET dataset between applications is much easier than transmitting an ADO disconnected recordset. To transmit an ADO disconnected recordset from one component to another, you use COM marshalling. To transmit data in ADO.NET, you use a dataset, which can transmit an XML stream.
o Richer data types.COM marshalling provides a limited set of data types - those defined by the COM standard. Because the transmission of datasets in ADO.NET is based on an XML format, there is no restriction on data types. Thus, the components sharing the dataset can use whatever rich set of data types they would ordinarily use.
o Performance. Transmitting a large ADO recordset or a large ADO.NET dataset can consume network resources; as the amount of data grows, the stress placed on the network also rises. Both ADO and ADO.NET let you minimize which data is transmitted. But ADO.NET offers another performance advantage, in that ADO.NET does not require data-type conversions. ADO, which requires COM marshalling to transmit records sets among components, does require that ADO data types be converted to COM data types.
o Penetrating Firewalls.A firewall can interfere with two components trying to transmit disconnected ADO recordsets. Remember, firewalls are typically configured to allow HTML text to pass, but to prevent system-level requests (such as COM marshalling) from passing. (More...)

what is difference Between datareader and dataset ?

  
DataReader
===========
DataReader is like a forward only recordset. It fetches one row at a time so very less network cost compare to DataSet(Fethces all the rows at a time). DataReader is readonly so we can't do any transaction on them. DataReader will be the best choice where we need to show the data to the user which requires no transaction. As DataReader is forward only so we can't fetch data randomly. .NET Data Providers optimizes the datareader to handle huge amount of data.

Dataset
=======
DataSet is an in memory representation of a collection of Database objects including tables of a relational database schemas.
DataSet is always a bulky object that requires a lot of memory space compare to DataReader. We can say that the DataSet is a small database because it stores the schema and data in the application memory area. DataSet fetches all data from the datasource at a time to its memory area. So we can traverse through the object to get the required data like querying database. (More...)

Difference between DataSet and DataReader

  
DataSet operates in connection less mode.
DataSet supports both read and write operations.
DataSet performace is less comapared to DatReader.


DatReader operates only in connection mode.
DatReader supports only read operations.
DatReader performace is high comapared to DataSet.


(More...)

What is typed dataset in C#?

  
A typed dataset is similar to a dataset with only difference is that the sehema is already present in typed dataset. so if any mismatch in the column will generate compile time errors rather than runtime error as in the case of normal dataset. Also accessing the column value is much easier than the normal dataset as the column definition will be available in the schema. (More...)

What happens when we issue Dataset.ReadXml command?

  
Reads XML schema and data into the DataSet. (More...)

How can we check that some changes have been made to dataset since it was loaded?

  


The changes made to the dataset can be tracked using the GetChanges and HasChanges methods.
GetChanges():
-------------
The GetChanges returns dataset which are changed since it was loaded or since Acceptchanges was executed.

HasChanges():
------------
The HasChanges property indicates if any changes were made to the dataset since it was loaded or if acceptchanges method was executed.

RejectChanges():
----------------
The RejectChanges can be used to revert thee changes made to the dataset since it was loaded

(More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend