Connection to MSSQL with .NET

The following code example can be used to access an MSSQL Database through .NET:

Add the following to your web.config file:

<add name="CONNECTION-NAME" connectionString="Data Source=DB-SERVER;Initial Catalog=DB-NAME;User ID=DB-USERNAME;Password=DB-PASSWORD" />

Replace DB-SERVER, DB-NAME, DB-USERNAME and DB-PASSWORD with the relevant values.

Article from category ASP & ASP.NET