0% found this document useful (0 votes)
145 views2 pages

ADO.NET DataAdapter Overview

A DataAdapter in ADO.NET serves as a bridge between a DataSet and a database, allowing data to be fetched, stored, and updated. It utilizes commands like SELECT, INSERT, UPDATE, and DELETE and operates in a disconnected architecture. Common use cases include offline data work, data binding to controls, and batch updates.

Uploaded by

patilsahana36
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
145 views2 pages

ADO.NET DataAdapter Overview

A DataAdapter in ADO.NET serves as a bridge between a DataSet and a database, allowing data to be fetched, stored, and updated. It utilizes commands like SELECT, INSERT, UPDATE, and DELETE and operates in a disconnected architecture. Common use cases include offline data work, data binding to controls, and batch updates.

Uploaded by

patilsahana36
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DataAdapter in ADO.

NET - Summary

Introduction

A DataAdapter in [Link] acts as a bridge between a DataSet (in-memory data) and a database. It helps

you fetch data from the database, store it in a DataSet, and optionally send changes back to the database.

Key Points

- It uses:

- SELECT command to fetch data

- INSERT, UPDATE, DELETE commands to update DB

- Works with disconnected architecture (data fetched, connection closed)

Example Code

Example: Reading Data using DataAdapter

string connectionString = "your_connection_string";

string query = "SELECT * FROM Bird_1199";

SqlConnection connection = new SqlConnection(connectionString);

SqlDataAdapter adapter = new SqlDataAdapter(query, connection);

DataSet ds = new DataSet();

[Link](ds); // fills the dataset with data from DB

foreach (DataRow row in [Link][0].Rows)

{
DataAdapter in [Link] - Summary

[Link](row["B_name"] + " - " + row["B_species"]);

Common Methods

Common Methods of DataAdapter:

- Fill(DataSet): fills the dataset with data from DB

- Update(DataSet): sends changes made in dataset back to DB

Use Cases

Use Cases:

- When you want to work offline with data

- When you want to bind data to controls (like in WinForms or WPF)

- For batch updates or disconnected data processing

You might also like