Home > DeveloperSection > Blogs > Connection String

Connection String


ADO.Net ADO.Net 
Ratings:
0 Comment(s)
 2019  View(s)
Rate this:

Connection String

 

Connection stringis the very important part, we use connection string to connect to our database(Database like: MSSQL Server, Oracle, MSACESS etc).

A connectionstring is a string version of the initialization propertiesneeded to connect to a data store and enables us to easily store connectioninformation within our application or to pass it between applications.

Connection String may contain “ServerName”, “DatabaseName”, “UserID”,“Password”

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();


Don't want to miss updates? Please click the below button!

Follow MindStick