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


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> ADO.Net >> Post New Question Subscribe to Interview Questions

Is it possible to load multiple tables in a Dataset?

Posted By :Bhumika Patel     Posted Date :March 07, 2013    Points :40   Category :ADO.Net 


Yes, it is possible to load multiple tables in a single dataset.29. Which provider is used to connect MS Access, Oracle, etc.?

OLEDB Provider and ODBC Provider are used to connect to MS Access and Oracle. Oracle Data Provider is also used to connect exclusively for oracle database.



You can also find related Interview Question to Is it possible to load multiple tables in a Dataset?  below: 

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

Populate multiple controls from DB in a single function using a single DataSet

  
Step 1:
- Write the different queries for getting the data from the DB for different controls in a single string variable by separating them with semicolon.

Ex -
//Create the SQL query.
string selectQueryForControlPopulation =
"SELECT COL1,COL2,... FROM TABLE_NAME1 WHERE CONDITION; SELECT COL1,COL2,..FROM TABLE_NAME2 WHERE CONDITION; ......";
Step 2:
- Create the DataAdapter, DataSet object. Execute the query and fill the DataSet object.

Ex -
//Create the Connection object.
OleDbConnection oConnection = new OleDbConnection(ConfigurationSettings.AppSettings["SQLConnectionString"]);

//Create the Command object.
OleDbCommand oCommand = new OleDbCommand(selectQueryForControlPopulation , oConnection );

//Create the DataAdapter object and set its property.
OleDbDataAdapter oAdapter = new OleDbDataAdapter();
oAdapter .SelectCommand = oCommandPopulateOrganizations;

// Create a DataSet object.
DataSet oDataSet = new DataSet();

//Filling the DataSet object.
oAdapter .Fill(oDataSet);

(**) The DataSet object contain the result of different queries as different tables. We can access those table to fill our controls.

http://www.mindfiresolutions.com/Populate-multiple-controls-from-DB-in-a-single-function-using-a-single-DataSet-831.php (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...)

Can code inside multiple catch block be executed?

  
No, Code can not execute in mutiple catch block (More...)

Does C# support multiple inheritance?

  
No

C# does not support multiple inheritance. A class can inherit from maximum one base class, although it can implement any number of interfaces. Like Java, C# does not support multiple inheritance, meaning that classes cannot inherit from more than one class (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...)

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