---
title: "Connection String"  
description: "Connection stringis the very important part, we use connection string to connect to our database(Database like: MSSQL Server, Oracle, MSACESS etc).  A"  
author: "Uttam Misra"  
published: 2010-10-21  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/27/connection-string  
category: "ado.net"  
tags: ["ado.net"]  
reading_time: 1 minute  

---

# Connection String

**[Connection string](https://www.mindstick.com/articles/328/connection-strings)**is the very important part, we use connection string to [connect](https://www.mindstick.com/articles/12810/how-to-connect-tablet-to-external-monitor-or-flat-screen-tv-using-computer-adapters) to our [database](https://www.mindstick.com/articles/12226/use-of-database-in-sencha-extjs-and-insert-record-from-user-form-using-ajax)(Database like: [MSSQL Server](https://www.mindstick.com/forum/159376/foreign-key-works-if-we-communicate-with-two-databases-in-mssql-server), [Oracle](https://www.mindstick.com/articles/13016/alter-table-statement-or-command-in-oracle), MSACESS etc).\

A connectionstring is a string [version](https://www.mindstick.com/articles/12845/things-to-remember-while-migrating-odoo-to-a-better-version) of the [initialization](https://www.mindstick.com/interview/160/what-is-the-difference-between-assignment-and-initialization) propertiesneeded to connect to a data store and enables us to easily store connectioninformation within our [application](https://www.mindstick.com/articles/12824/calculator-application-in-android) or to pass it between applications.

Connection String may contain “ServerName”, “DatabaseName”, “UserID”,“[Password](https://www.mindstick.com/blog/118/retriving-user-password-by-using-stored-procedure-in-asp-dot-net)”

##### For example:

```
SqlConnection con = new SqlConnection("server=XYZ\\sqlexpress; database=Hello; uid=sa;password=sa ");Server Name = ”server=XYZ\\sqlexpress”
Database = ”Hello”
UserID  = ”sa”Password =”sa”//Openconnection  
con.Open();//Closeconnection  
con.Close();
```

---

Original Source: https://www.mindstick.com/blog/27/connection-string

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
