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


Top 5 Contributors of the Month
Jean Paul
satyapriyanayak
SP
Ashutosh Jha
Simon Robert VoIP

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

What is typed dataset in C#?

Posted By :Amit Mehra     Posted Date :August 06, 2008    Points :10   Category :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.

You can also find related Interview Question to What is typed dataset in C#?  below: 

What is Strongly typed dataset?

  
Strongly typed dataset is simple dataset containing the property to have datatype associated with columns and can access column values by using the column names.
(More...)

What happens when we issue Dataset.ReadXml command?

  
Reads XML schema and data into the DataSet. (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...)

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...)

You are working with a DataSet and want to be able to display data, sorted different ways. How do you do so?

  
Select the correct answer.

1. Use the Sort method on the DataTable object.
2. Use the DataSet object's Sort method.
3. Use a DataView object for each sort.
4. Create a DataTable for each sort, using the DataTable object's Copy method, and then Sort the result


Correct Answer is :
3. Use a DataView object for each sort. (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...)

The DataSet class can best be described .....

  
as a disconnected, in memory database (More...)

Explain the steps involved to populate dataset with data?

  
Open connection.;
Initialize Adapter passing SQL and connection as parameter.;
Initialize Dataset.;
Call Fill method of the adapter passes dataset as the parameter.;
Close connection.; (More...)

Is it possible to have tables in the dataset that are not bound to any data source?

  
Yes, I can create table object in code and add it to the dataset. (More...)

What is the use of DataSet?

  
DataSet acts as a virtual table. The value is retrieved from the database and stores in the DataSet. Then we can pass the data to the DataGrid through DataSet. (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...)

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