Sunday, 12 May 2013

CONNECTION STRING IN ASP.NET AND SQL SERVER

CONNECTION STRING IN ASP.NET 

When a connection is formed between  SQL Server  and ASP.NET  in that case  string  is generated which is known as connection string .

Connection String should be written in that file which does not compile. (the non-compiled file is web.config )


Connection String on Web.Config File : 


<?xml version="1.0"?>

<configuration>

    <system.web>
        <compilation debug="false" targetFramework="4.0" />

    </system.web>
  <connectionStrings>
    <add name="cn"    connectionString="server=servername/instancename;Database=databasename;uid=sa;
     pwd=123 " />
  </connectionStrings>
</configuration>