---
title: "Database Connection"  
description: "ADO.NET is also a part of the .NET Framework. ADO.NET is used to handle data access. With ADO.NET you can work with databases.      ADO.NET is a part"  
author: "Pushpendra Singh"  
published: 2010-11-10  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/50/database-connection  
category: "ado.net"  
tags: ["ado.net"]  
reading_time: 1 minute  

---

# Database Connection

[ADO.NET](https://www.mindstick.com/articles/804/connection-pooling-in-ado-dot-net) is also a part of the .NET [Framework](https://www.mindstick.com/forum/34615/software-framework-vs-library). ADO.NET is used to handle [data access](https://www.mindstick.com/blog/301551/risks-and-challenges-of-data-access-and-sharing). With ADO.NET you can work with databases.\
\
ADO.NET is a part of the .NET Framework\
ADO.NET consists of a set of classes used to [handle data](https://www.mindstick.com/forum/160198/how-do-you-handle-data-paging-and-pagination-in-sql-server-efficiently) access\
\

##### Create a Database Connection

```
SqlConnection con = new SqlConnection(sqlString);con.Open(); SqlCommand cmd = new SqlCommand("select id, pass from student", con);SqlDataReader dr = cmd.ExecuteReader();
con.Close();use following namspaceusing System.Data;
 using System.Data.SqlClient;string sqlString = "Server=(local); Database=my; User Id=sa; Password=sa";
```

---

Original Source: https://www.mindstick.com/blog/50/database-connection

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
