---
title: "DataAdapter"  
description: "Data Adapter serves a bridge between dataset and data source for retrieving and saving data from the database. The data Adapter provides this bridge b"  
author: "Amit Singh"  
published: 2010-08-29  
updated: 2017-11-30  
canonical: https://www.mindstick.com/articles/120/dataadapter  
category: "ado.net"  
tags: ["ado.net"]  
reading_time: 1 minute  

---

# DataAdapter

## DATA ADAPTER

Data Adapter serves a bridge between dataset and [data source](https://www.mindstick.com/forum/160659/how-do-you-create-a-custom-filter-to-filter-any-text-in-the-data-source-in-angularjs) for retrieving and saving [data from the database](https://www.mindstick.com/forum/160510/how-to-fetch-data-from-the-database-in-the-dot-net-console-application-using-c-sharp). The data Adapter provides this bridge by mapping fill which changes the data in dataset to make the data in data source.

Data Adapters can be created by using;

· Data Adapters wizards

· Using solution explorer.

· Using .net classes in the code

Data Adapters is a powerful tools which:

· Creates data connection

· Invoke the command

· Fill the dataset in [asp.net application](https://www.mindstick.com/forum/540/using-stored-procedures-with-entity-framework-in-an-asp-dot-net-application) with [data from database](https://www.mindstick.com/forum/34370/how-to-populate-google-charts-using-data-from-database-created-via-data-first-asp-dot-net-mvc).

Data Adapter has following properties to execute the records from the database like Select Command, Insert Command, and Delete Command.

The following example shows data Adapter in c#.

//these lines are for creating a new connection by passing [server name](https://answers.mindstick.com/qa/110129/how-to-change-discord-server-name),uid,password and [name of the database](https://answers.mindstick.com/qa/96783/what-is-the-name-of-the-database-used-in-android) as here mind.

[SqlConnection](https://www.mindstick.com/forum/1209/sqlconnection-sqlcommand-sqldatareader-idisposable) con = new SqlConnection("server=abc-pc1\\sqlexpress; uid=sa; password=sa; database=mind");

//open connection

con.Open();

//create a data adapter and invoking the command.

[SqlDataAdapter](https://www.mindstick.com/interview/33991/what-is-sqldataadapter) ad = new SqlDataAdapter("select * from Employee", con);

//creating datatable object

`Datatable dt = new DataTable();`

//use dataadapter to fill [data table](https://www.mindstick.com/forum/275/how-to-get-max-and-min-value-of-columns-in-data-table)\
`ad.Fill(dt);`

//[close the connection](https://www.mindstick.com/forum/87/how-use-the-dispose-method-for-close-the-connection)

con.Open();

---

Original Source: https://www.mindstick.com/articles/120/dataadapter

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
