web.config connection string in c# asp.net

Web.config

<?xml version="1.0"?>
<configuration>
  <connectionStrings>
    <add name="conString" connectionString="Data Source=NEERAJ-PC\Neeraj; Initial Catalog =registrationform ;User ID=sa; Password=12345678"/>
   
  </connectionStrings>
       <system.web>
              <compilation debug="true" targetFramework="4.0"/>
       </system.web>
</configuration>

C# code:-

String ConnString = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
        SqlConnection con = new SqlConnection(ConnString);
        SqlCommand cmd = new SqlCommand();


web.config connection string in c# asp.net web.config connection string in c# asp.net Reviewed by NEERAJ SRIVASTAVA on 12:39:00 PM Rating: 5

No comments:

Powered by Blogger.