0% found this document useful (0 votes)
4 views7 pages

Unit 4

ADO.NET is a Microsoft technology that enables applications to connect to databases using a disconnected architecture, allowing data to be fetched and worked on offline. Its key features include high performance, XML data handling, scalability, security, and interoperability with various database types. The architecture consists of connected and disconnected components, with core elements like Connection, Command, DataAdapter, and DataSet facilitating database interactions.

Uploaded by

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

Unit 4

ADO.NET is a Microsoft technology that enables applications to connect to databases using a disconnected architecture, allowing data to be fetched and worked on offline. Its key features include high performance, XML data handling, scalability, security, and interoperability with various database types. The architecture consists of connected and disconnected components, with core elements like Connection, Command, DataAdapter, and DataSet facilitating database interactions.

Uploaded by

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

4.1 Features of ADO.

NET & Architecture


🔹 What is [Link]?
[Link] is a technology by Microsoft used to connect applications (like web apps or desktop
apps) to databases.

👉 In simple words:
[Link] helps your program talk to a database.

🌟 Features of [Link]
1. 🔌 Disconnected Architecture

 Unlike old systems, [Link] does NOT require a continuous connection.


 Data is fetched, stored locally, and connection is closed.

✅ Example:

 You load student data → connection closes → you still work on data offline.

2. ⚡ High Performance

 Since connection is not always open, it saves resources.


 Faster execution.

3. 📦 Data in XML Format

 [Link] can store and transfer data in XML.

👉 XML = structured data format

4. 🔄 Scalability

 Works well even when many users access data at the same time.
5. 🔐 Security

 Connections are opened only when needed → reduces risk.

6. 🧩 Interoperability

 Works with multiple database types (SQL Server, Oracle, etc.)

Architecture of [Link]
[Link] has two main parts:

1. 🟢 Connected Architecture

 Requires continuous connection to database


 Uses:
o Connection
o Command
o DataReader

👉 Example:

 Reading live bank balance

2. 🔵 Disconnected Architecture

 Works without continuous connection


 Uses:
o DataAdapter
o DataSet

👉 Example:

 Editing data offline


🧱 Core Components of [Link]

1. 🔗 Connection

 Used to connect to database

👉 Example:

SqlConnection con = new SqlConnection("connection_string");


[Link]();

Think of it as:
👉 “Door to the database”

2. 📝 Command

 Used to run SQL queries

👉 Example:

SqlCommand cmd = new SqlCommand("SELECT * FROM Students", con);

👉 It tells database what to do.

3. 🔄 DataAdapter

 Acts as a bridge between database and DataSet

👉 Example:

SqlDataAdapter da = new SqlDataAdapter(cmd);

👉 It:

 Fetches data
 Sends updates back

4. 📦 DataSet
 Stores data in memory (like a mini database)

👉 Example:

DataSet ds = new DataSet();


[Link](ds);

👉 Features:

 Can store multiple tables


 Works offline

🔁 Flow Summary

1. Connection opens
2. Command runs query
3. DataAdapter fills DataSet
4. Connection closes
5. Work continues offline

📘 4.2 Database Programming with


[Link]

🔹 What is Database Programming?


It means:
👉 Writing code to interact with a database

🔌 Database Connections
 Required to communicate with database

👉 Types:

 SQL Server → SqlConnection


 Oracle → OracleConnection

🔧 Data Access Techniques


1. Connected (DataReader)

 Fast
 Read-only
 Forward-only

👉 Example:

SqlDataReader dr = [Link]();

2. Disconnected (DataSet)

 Flexible
 Editable

📄 XML Language
 Used to store and transport data

👉 Example:

<Student>
<Name>Rahul</Name>
<Age>20</Age>
</Student>

👉 [Link] can convert data to XML easily.

🧮 SQL (Structured Query Language)


Used to:

 Insert data
 Update data
 Delete data
 Fetch data

👉 Example:

SELECT * FROM Students;

🧩 [Link] Object Model


Main objects:

Object Purpose
Connection Connect to DB
Command Execute SQL
DataReader Read data
DataAdapter Transfer data
DataSet Store data

🔗 LINQ and [Link]

🔹 What is LINQ?
LINQ is a feature in .NET used to query data using C# instead of SQL.

👉 Simple meaning:
Write queries in programming language instead of SQL

🔹 LINQ to SQL
 Used to connect database using LINQ

👉 Example:

var result = from s in Students


where [Link] > 18
select s;

👉 Benefits:
 Less code
 Easy to read
 Type-safe

🔹 [Link] and LINQ


 [Link] → low-level database access
 LINQ → high-level querying

👉 Together:

 [Link] handles connection


 LINQ handles querying

🔹 LINQ to XML
Used to query XML data using LINQ

👉 Example:

var data = from x in [Link]("Student")


select [Link]("Name").Value;

👉 Makes XML handling very easy

🧠 Simple Real-Life Analogy


Think of [Link] like a food delivery system:

Component Real-life meaning


Connection Phone call to restaurant
Command Order you place
DataAdapter Delivery person
DataSet Food stored at home
DataReader Eating directly at restaurant

You might also like