Forum

How to Connect to SQL database using asp.net  

  RSS

sekhar
New Member
Joined: 2 years  ago
Posts: 2
06/02/2017 11:37 am  

How to Connect to SQL database using asp.net?

Edited: 2 years  ago

ReplyQuote
sekhar
New Member
Joined: 2 years  ago
Posts: 2
02/08/2017 10:16 am  

We have 3 simple steps to do this.
1.Declare a  connection object 

SqlConnection con = new SqlConnection();
string connection = "datsource=[servername];database=[databasename];user id=[sa];pwd=[pwd]";
con.ConnectionString = connection;

2. Open the connection


con.Open();

3. Close Connection

con.Close();

This is how we connect to MS SQL Server using c#.net

Edited: 2 years  ago

ReplyQuote
  
Working

Please Login or Register