Xpode.com        Click here to Print this article.

ADO.NET interview questions: - What are basic methods of Data adapter and mention the use of data adapter?

There are three most commonly used methods of Data adapter: -

Fill: - Executes the Select Command to fill the Dataset object with data from the data source. It can also be used to update (refresh) an existing table in a Dataset with changes made to the data in the original data source if there is a primary key in the table in the Dataset.

Fill Schema: - Extracts just the schema for a table from the data source, and creates an empty table in the DataSet object with all the correspondingconstraints.

Update: - Updates the original datasource with the changes made to the content of the DataSet.

Use of data adapter

Data adapter object acts like a bridge it helps to load the dataset object.  Below is a simple code snippet which shows how the dataadapter object is created and then using the fill method the dataset object is loaded.

SqlDataAdapter objAdapter = new SqlDataAdapter(objCommand);

DataSet objDataset = new DataSet();

objAdapter.Fill(objDataset);

Above is the ADO.NET interview questions and see following video on dataset is a connected while datareader is disconnected: -  



http://
http://www.questpond.com/

Contributed by:
Shivprasad koirala Koirala
I am a Microsoft MVP for ASP/ASP.NET and currently a CEO of a small E-learning company in India. We are very much active in making training videos , writing books and corporate trainings. Do visit my site http://www.questpond.com for .NET, C# , design pattern , WCF , Silverlight , LINQ , ASP.NET , ADO.NET , Sharepoint , UML , SQL Server training and Interview questions and answers

Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=695

Click here to go on website